Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, August 16, 2018 10:03:34 AM(UTC)
Nick Villalobos

Groups: Registered
Posts: 119

Was thanked: 4 time(s) in 4 post(s)

The ForceTextPath property is only used when loading PDF files. This 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%.

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.

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 this property is set to false, 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 set to 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.

The code for this property is very simple.
Code:
RasterCodecs codecs = new RasterCodecs();

CodecsLoadSvgOptions svgOptions = new CodecsLoadSvgOptions();
svgOptions.ForceTextPath = true;

using (SvgDocument svgDocument = codecs.LoadSvg(pdfInput, 1, svgOptions) as SvgDocument)
{
    svgDocument.SaveToFile(svgOutput, null);
}
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.100 seconds.