DocumentGetSvgOptions Enumeration

Summary

Options to use when getting an SVG document for a page.

Syntax
TypeScript
JavaScript
lt.Document.DocumentGetSvgOptions = { 
   none: 0, 
   allowPolylineText: 1, 
   dropImages: 2, 
   dropShapes: 4, 
   dropText: 8, 
   forConversion: 16, 
   ignoreXmlParsingErrors: 32, 
   forceRealText: 64, 
   forceTextPath: 1 
} 
lt.Document.DocumentGetSvgOptions = { 
   none: 0, 
   allowPolylineText: 1, 
   dropImages: 2, 
   dropShapes: 4, 
   dropText: 8, 
   forConversion: 16, 
   ignoreXmlParsingErrors: 32, 
   forceRealText: 64, 
   forceTextPath: 1 
} 

Members

0 None

(0) Default. Get the SVG as is.

1 AllowPolylineText

(1) This enumeration is deprecated and replaced by ForceTextPath.

2 DropImages

(2) Drop the image elements of the SVG during load.

4 DropShapes

(4) Drop any element that is not text or image during load.

8 DropText

(8) Drop the text elements of the SVG during load.

16 ForConversion

(16) The created SVG should be optimized for conversion.

When ForConversion is not used, the engine might massage some of the elements for view optimization by using correction transformation matrices.

This is the default behavior and is the most recommended when loading a document as SVG for viewing purposing since it generates the most natural flow of the document elements (especially text).

When ForConversion is used, this behavior is not used and the elements are loaded as is. This is used when this SVG document is used for conversion purposes.

LEADTOOLS Document Viewer loads SVG documents without ForConversion since the framework is viewing the SVG.

LEADTOOLS Document Converters loads SVG document with ForConversion since the framework is using the SVG for conversion from one format to another and is never viewed.

32 IgnoreXmlParsingErrors

(32) The engine will should relax the XML parsing rules and try to ignore insignificant errors in the XML data if possible. For example, tags that are not closed and elements or attributes that do not adhere to the SVG standard specification.

64 ForceRealText

(64) Indicates that all text is converted to text elements.

1 ForceTextPath

(1) Indicates that all text is replaced by path elements.

ForceTextPath and ForceRealText can be used to control how the toolkit treats any text elements found in the source document when GetSvg or GetSvgUrl is called.

Text found in the source document are usually converted to text elements with the appropriate font family name, size and style. If the resulting SVG file is then viewed in the system that does not have this font installed, it might get substituted by an equivalent font by the viewer (such as, a web browser). This may result in the resulting SVG file not matching the original document 100%.

Also, some PDF files are encoded in a way where the text element have completely different characters than what appears on the screen due to the PDF font embedding feature. This is used by many PDF files as a form of protection against copying/pasting the content from a viewer. The PDF file may contain some text that can be viewed correctly using real text elements and then some text that cannot.

Rasterizing these PDF documents is not a problem since the engine will draw the font from the internal data found in the PDF into the destinations surface at load time.

For text that cannot be viewed correctly as SVG using text elements, a workaround is to replace the text with path elements that 100% match the data found in the file. This results in an SVG file that 100% matches the original document but may increase the size of the SVG data and of course the text itself is lost and cannot be obtained from the SVG.

When the values of ForceTextPath and ForceRealText are both false (the default values), the engine works in Auto mode. Here, the toolkit will replace only the text that is not guaranteed to be viewable by path elements. This is the recommended loading a PDF file as SVG for viewing purposes.

When ForceTextPath is used in the options, then all text is replaced by path elements. This guarantees that the resulting SVG will match the source document 100%. Naturally, this result in an SVG file that does not have any text elements to parse. This may result in larger SVG data and should be used when exact match of the source document and what is being viewed is absolutely needed.

When ForceRealText is used in the options, then all text is converted into text elements by the engine. This mode is suitable when the SVG is obtained for text searching.

Both ForceTextPath and ForceRealText are only used when loading PDF files.

Remarks

Creating an SVG document with text only is desired in certain scenarios. For example, if the application loads SVG document to parse the text values and store them in an external database for text search purposes, then using DropImages and DropShapes will speed up the loading operation and elements not required will be discarded. This is especially useful if the original SVG document contains image elements which may use a lot of memory and disk space.

Requirements

Target Platforms

See Also

Reference

Leadtools.Document Namespace

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly