public class SvgSaveOptions extends FixedPageSaveOptions
SaveFormat.SVG format.
To learn more, visit the Specify Save Options documentation article.
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
| Modifier and Type | Method and Description |
|---|---|
boolean |
getExportEmbeddedImages()
Specifies whether images should be embedded into the SVG document as base64.
|
boolean |
getFitToViewPort()
Specifies if the output SVG should fill the available viewport area (browser window or container).
|
java.lang.String |
getIdPrefix()
Specifies a prefix that is prepended to all generated element IDs in the output document.
|
int |
getMaxImageResolution()
Gets a value in pixels per inch that limits resolution of exported raster images.
|
boolean |
getRemoveJavaScriptFromLinks()
Specifies whether JavaScript will be removed from links.
|
IResourceSavingCallback |
getResourceSavingCallback()
Allows to control how resources (images) are saved when a document is exported to SVG format.
|
java.lang.String |
getResourcesFolder()
Specifies the physical folder where resources (images) are saved when exporting a document to Svg format.
|
java.lang.String |
getResourcesFolderAlias()
Specifies the name of the folder used to construct image URIs written into an SVG document.
|
int |
getSaveFormat()
Specifies the format in which the document will be saved if this save options object is used.
|
boolean |
getShowPageBorder()
Controls whether a border is added to the outline of the page.
|
int |
getTextOutputMode()
Gets a value determining how text should be rendered in SVG.
|
void |
setExportEmbeddedImages(boolean value)
Specifies whether images should be embedded into the SVG document as base64.
|
void |
setFitToViewPort(boolean value)
Specifies if the output SVG should fill the available viewport area (browser window or container).
|
void |
setIdPrefix(java.lang.String value)
Specifies a prefix that is prepended to all generated element IDs in the output document.
|
void |
setMaxImageResolution(int value)
Sets a value in pixels per inch that limits resolution of exported raster images.
|
void |
setRemoveJavaScriptFromLinks(boolean value)
Specifies whether JavaScript will be removed from links.
|
void |
setResourceSavingCallback(IResourceSavingCallback value)
Allows to control how resources (images) are saved when a document is exported to SVG format.
|
void |
setResourcesFolder(java.lang.String value)
Specifies the physical folder where resources (images) are saved when exporting a document to Svg format.
|
void |
setResourcesFolderAlias(java.lang.String value)
Specifies the name of the folder used to construct image URIs written into an SVG document.
|
void |
setSaveFormat(int value)
Specifies the format in which the document will be saved if this save options object is used.
|
void |
setShowPageBorder(boolean value)
Controls whether a border is added to the outline of the page.
|
void |
setTextOutputMode(int value)
Sets a value determining how text should be rendered in SVG.
|
assertValidIdPrefix, equals, getColorMode, getJpegQuality, getMetafileRenderingOptions, getNumeralFormat, getOptimizeOutput, getPageSavingCallback, getPageSet, isValidIdPrefix, setColorMode, setJpegQuality, setMetafileRenderingOptions, setNumeralFormat, setOptimizeOutput, setPageSavingCallback, setPageSetcreateSaveOptions, createSaveOptions, getAllowEmbeddingPostScriptFonts, getCustomTimeZoneInfo, getDefaultTemplate, getDml3DEffectsRenderingMode, getDmlEffectsRenderingMode, getDmlRenderingMode, getExportGeneratorName, getImlRenderingMode, getMemoryOptimization, getPrettyFormat, getProgressCallback, getTempFolder, getUpdateAmbiguousTextFont, getUpdateCreatedTimeProperty, getUpdateFields, getUpdateLastPrintedProperty, getUpdateLastSavedTimeProperty, getUseAntiAliasing, getUseHighQualityRendering, setAllowEmbeddingPostScriptFonts, setCustomTimeZoneInfo, setDefaultTemplate, setDml3DEffectsRenderingMode, setDmlEffectsRenderingMode, setDmlRenderingMode, setExportGeneratorName, setImlRenderingMode, setMemoryOptimization, setPrettyFormat, setProgressCallback, setTempFolder, setUpdateAmbiguousTextFont, setUpdateCreatedTimeProperty, setUpdateFields, setUpdateLastPrintedProperty, setUpdateLastSavedTimeProperty, setUseAntiAliasing, setUseHighQualityRenderingpublic int getSaveFormat()
SaveFormat.SVG.
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
getSaveFormat in class SaveOptionsint value. The returned value is one of SaveFormat constants.public void setSaveFormat(int value)
SaveFormat.SVG.
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
setSaveFormat in class SaveOptionsvalue - The corresponding int value. The value must be one of SaveFormat constants.public boolean getShowPageBorder()
true.
Examples:
Shows how to mimic the properties of images when converting a .docx document to .svg.
Document doc = new Document(getMyDir() + "Document.docx");
// Configure the SvgSaveOptions object to save with no page borders or selectable text.
SvgSaveOptions options = new SvgSaveOptions();
{
options.setFitToViewPort(true);
options.setShowPageBorder(false);
options.setTextOutputMode(SvgTextOutputMode.USE_PLACED_GLYPHS);
}
doc.save(getArtifactsDir() + "SvgSaveOptions.SaveLikeImage.svg", options);
boolean value.public void setShowPageBorder(boolean value)
true.
Examples:
Shows how to mimic the properties of images when converting a .docx document to .svg.
Document doc = new Document(getMyDir() + "Document.docx");
// Configure the SvgSaveOptions object to save with no page borders or selectable text.
SvgSaveOptions options = new SvgSaveOptions();
{
options.setFitToViewPort(true);
options.setShowPageBorder(false);
options.setTextOutputMode(SvgTextOutputMode.USE_PLACED_GLYPHS);
}
doc.save(getArtifactsDir() + "SvgSaveOptions.SaveLikeImage.svg", options);
value - The corresponding boolean value.public int getTextOutputMode()
Remarks:
Use this property to get or set the mode of how text inside a document should be rendered when saving in SVG format.
The default value is SvgTextOutputMode.USE_TARGET_MACHINE_FONTS.
Examples:
Shows how to mimic the properties of images when converting a .docx document to .svg.
Document doc = new Document(getMyDir() + "Document.docx");
// Configure the SvgSaveOptions object to save with no page borders or selectable text.
SvgSaveOptions options = new SvgSaveOptions();
{
options.setFitToViewPort(true);
options.setShowPageBorder(false);
options.setTextOutputMode(SvgTextOutputMode.USE_PLACED_GLYPHS);
}
doc.save(getArtifactsDir() + "SvgSaveOptions.SaveLikeImage.svg", options);
SvgTextOutputMode constants.public void setTextOutputMode(int value)
Remarks:
Use this property to get or set the mode of how text inside a document should be rendered when saving in SVG format.
The default value is SvgTextOutputMode.USE_TARGET_MACHINE_FONTS.
Examples:
Shows how to mimic the properties of images when converting a .docx document to .svg.
Document doc = new Document(getMyDir() + "Document.docx");
// Configure the SvgSaveOptions object to save with no page borders or selectable text.
SvgSaveOptions options = new SvgSaveOptions();
{
options.setFitToViewPort(true);
options.setShowPageBorder(false);
options.setTextOutputMode(SvgTextOutputMode.USE_PLACED_GLYPHS);
}
doc.save(getArtifactsDir() + "SvgSaveOptions.SaveLikeImage.svg", options);
value - A value determining how text should be rendered in SVG. The value must be one of SvgTextOutputMode constants.public java.lang.String getResourcesFolder()
null.
Remarks:
Has effect only if getExportEmbeddedImages() / setExportEmbeddedImages(boolean) property is false.
When you save a Document in SVG format, Aspose.Words needs to save all images embedded in the document as standalone files. getResourcesFolder() / setResourcesFolder(java.lang.String) allows you to specify where the images will be saved and getResourcesFolderAlias() / setResourcesFolderAlias(java.lang.String) allows to specify how the image URIs will be constructed.
If you save a document into a file and provide a file name, Aspose.Words, by default, saves the images in the same folder where the document file is saved. Use getResourcesFolder() / setResourcesFolder(java.lang.String) to override this behavior.
If you save a document into a stream, Aspose.Words does not have a folder where to save the images, but still needs to save the images somewhere. In this case, you need to specify an accessible folder in the getResourcesFolder() / setResourcesFolder(java.lang.String) property
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
String value.getResourcesFolderAlias(),
setResourcesFolderAlias(java.lang.String)public void setResourcesFolder(java.lang.String value)
null.
Remarks:
Has effect only if getExportEmbeddedImages() / setExportEmbeddedImages(boolean) property is false.
When you save a Document in SVG format, Aspose.Words needs to save all images embedded in the document as standalone files. getResourcesFolder() / setResourcesFolder(java.lang.String) allows you to specify where the images will be saved and getResourcesFolderAlias() / setResourcesFolderAlias(java.lang.String) allows to specify how the image URIs will be constructed.
If you save a document into a file and provide a file name, Aspose.Words, by default, saves the images in the same folder where the document file is saved. Use getResourcesFolder() / setResourcesFolder(java.lang.String) to override this behavior.
If you save a document into a stream, Aspose.Words does not have a folder where to save the images, but still needs to save the images somewhere. In this case, you need to specify an accessible folder in the getResourcesFolder() / setResourcesFolder(java.lang.String) property
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
value - The corresponding String value.getResourcesFolderAlias(),
setResourcesFolderAlias(java.lang.String)public java.lang.String getResourcesFolderAlias()
null.
Remarks:
When you save a Document in SVG format, Aspose.Words needs to save all images embedded in the document as standalone files. getResourcesFolder() / setResourcesFolder(java.lang.String) allows you to specify where the images will be saved and getResourcesFolderAlias() / setResourcesFolderAlias(java.lang.String) allows to specify how the image URIs will be constructed.
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
String value.getResourcesFolder(),
setResourcesFolder(java.lang.String)public void setResourcesFolderAlias(java.lang.String value)
null.
Remarks:
When you save a Document in SVG format, Aspose.Words needs to save all images embedded in the document as standalone files. getResourcesFolder() / setResourcesFolder(java.lang.String) allows you to specify where the images will be saved and getResourcesFolderAlias() / setResourcesFolderAlias(java.lang.String) allows to specify how the image URIs will be constructed.
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
value - The corresponding String value.getResourcesFolder(),
setResourcesFolder(java.lang.String)public boolean getExportEmbeddedImages()
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
boolean value.public void setExportEmbeddedImages(boolean value)
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
value - The corresponding boolean value.public int getMaxImageResolution()
Remarks:
If the value of this property is non-zero, it limits resolution of exported raster images. That is, higher-resolution images are resampled down to the limit and lower-resolution images are exported as is.
If the value of this property is zero, all raster images are exported without resampling.
Examples:
Shows how to set limit for image resolution.
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.setMaxImageResolution(72);
doc.save(getArtifactsDir() + "SvgSaveOptions.MaxImageResolution.svg", saveOptions);
public void setMaxImageResolution(int value)
Remarks:
If the value of this property is non-zero, it limits resolution of exported raster images. That is, higher-resolution images are resampled down to the limit and lower-resolution images are exported as is.
If the value of this property is zero, all raster images are exported without resampling.
Examples:
Shows how to set limit for image resolution.
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.setMaxImageResolution(72);
doc.save(getArtifactsDir() + "SvgSaveOptions.MaxImageResolution.svg", saveOptions);
value - A value in pixels per inch that limits resolution of exported raster images.public boolean getFitToViewPort()
true width and height of output SVG are set to 100%.
The default value is false.
Examples:
Shows how to mimic the properties of images when converting a .docx document to .svg.
Document doc = new Document(getMyDir() + "Document.docx");
// Configure the SvgSaveOptions object to save with no page borders or selectable text.
SvgSaveOptions options = new SvgSaveOptions();
{
options.setFitToViewPort(true);
options.setShowPageBorder(false);
options.setTextOutputMode(SvgTextOutputMode.USE_PLACED_GLYPHS);
}
doc.save(getArtifactsDir() + "SvgSaveOptions.SaveLikeImage.svg", options);
boolean value.public void setFitToViewPort(boolean value)
true width and height of output SVG are set to 100%.
The default value is false.
Examples:
Shows how to mimic the properties of images when converting a .docx document to .svg.
Document doc = new Document(getMyDir() + "Document.docx");
// Configure the SvgSaveOptions object to save with no page borders or selectable text.
SvgSaveOptions options = new SvgSaveOptions();
{
options.setFitToViewPort(true);
options.setShowPageBorder(false);
options.setTextOutputMode(SvgTextOutputMode.USE_PLACED_GLYPHS);
}
doc.save(getArtifactsDir() + "SvgSaveOptions.SaveLikeImage.svg", options);
value - The corresponding boolean value.public java.lang.String getIdPrefix()
String value.java.lang.IllegalArgumentException - The value does not meet the requirements specified above.
Remarks:
If the prefix is specified, it can contain only letters, digits, underscores, and hyphens, and must start with a letter.
Examples:
Shows how to add a prefix that is prepended to all generated element IDs (svg).
Document doc = new Document(getMyDir() + "Id prefix.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.setIdPrefix("pfx1_");
doc.save(getArtifactsDir() + "SvgSaveOptions.IdPrefixSvg.html", saveOptions);
public void setIdPrefix(java.lang.String value)
value - The corresponding String value.java.lang.IllegalArgumentException - The value does not meet the requirements specified above.
Remarks:
If the prefix is specified, it can contain only letters, digits, underscores, and hyphens, and must start with a letter.
Examples:
Shows how to add a prefix that is prepended to all generated element IDs (svg).
Document doc = new Document(getMyDir() + "Id prefix.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.setIdPrefix("pfx1_");
doc.save(getArtifactsDir() + "SvgSaveOptions.IdPrefixSvg.html", saveOptions);
public IResourceSavingCallback getResourceSavingCallback()
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
IResourceSavingCallback value.public void setResourceSavingCallback(IResourceSavingCallback value)
Examples:
Shows how to manipulate and print the URIs of linked resources created while converting a document to .svg.
public void svgResourceFolder() throws Exception {
Document doc = new Document(getMyDir() + "Rendering.docx");
SvgSaveOptions options = new SvgSaveOptions();
{
options.setSaveFormat(SaveFormat.SVG);
options.setExportEmbeddedImages(false);
options.setResourcesFolder(getArtifactsDir() + "SvgResourceFolder");
options.setResourcesFolderAlias(getArtifactsDir() + "SvgResourceFolderAlias");
options.setShowPageBorder(false);
options.setResourceSavingCallback(new ResourceUriPrinter());
}
new File(options.getResourcesFolderAlias()).mkdir();
doc.save(getArtifactsDir() + "SvgSaveOptions.SvgResourceFolder.svg", options);
}
/// <summary>
/// Counts and prints URIs of resources contained by as they are converted to .svg.
/// </summary>
private static class ResourceUriPrinter implements IResourceSavingCallback {
public void resourceSaving(ResourceSavingArgs args) {
System.out.println(MessageFormat.format("Resource #{0} \"{1}\"", ++mSavedResourceCount, args.getResourceFileName()));
System.out.println("\t" + args.getResourceFileUri());
}
private int mSavedResourceCount;
}
value - The corresponding IResourceSavingCallback value.public boolean getRemoveJavaScriptFromLinks()
false. If this option is enabled, all links containing JavaScript will be replaced with "javascript:void(0)".
Examples:
Shows how to remove JavaScript from the links (svg).
Document doc = new Document(getMyDir() + "JavaScript in HREF.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.setRemoveJavaScriptFromLinks(true);
doc.save(getArtifactsDir() + "SvgSaveOptions.RemoveJavaScriptFromLinksSvg.html", saveOptions);
boolean value.public void setRemoveJavaScriptFromLinks(boolean value)
false. If this option is enabled, all links containing JavaScript will be replaced with "javascript:void(0)".
Examples:
Shows how to remove JavaScript from the links (svg).
Document doc = new Document(getMyDir() + "JavaScript in HREF.docx");
SvgSaveOptions saveOptions = new SvgSaveOptions();
saveOptions.setRemoveJavaScriptFromLinks(true);
doc.save(getArtifactsDir() + "SvgSaveOptions.RemoveJavaScriptFromLinksSvg.html", saveOptions);
value - The corresponding boolean value.