←Select platform

ForceTextPath Property


Indicates whether to replace all text by path elements..

public bool ForceTextPath { get; set; } 
Public Property ForceTextPath() As Boolean 
   property bool ForceTextPath 
      bool get() 
      void set(bool value) 

Property Value

true to replace all text by path elements; otherwise, false. Default value is false.


ForceTextPath and ForceRealText can be used to control how the RasterCodecs object treats any text elements found in the source document when RasterCodecs.LoadSvg is called.

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

Also, some PDF files are encoded in such a way that the text elements have completely different characters than what appears on the screen because of 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 can contain some text that can be viewed correctly using real text elements and some text that cannot.

Rasterizing such PDF documents is not a problem since the engine will draw the font from the internal data found in the PDF into the destination's 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 can 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 way to load a PDF file as SVG for viewing purposes.

When the value of ForceTextPath is true, then all text is replaced by path elements. This guarantees that the resulting SVG will match the source document 100%. Naturally, this results in an SVG file that does not have any text elements available to parse. This can result in larger SVG data files. It should be used only when an exact match between the source document and what is being viewed is absolutely required.

When the value of ForceRealText is true, 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.


Target Platforms

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

Leadtools.Codecs Assembly