How to I convert PDF to optimized SVG ?

72 views
Skip to first unread message

Support

unread,
Apr 12, 2011, 2:04:33 PM4/12/11
to PDF2SVG
Q: I've downloaded your demo and am using PDF to SVG converter. Pretty
cool. Now, can you tell me if the program is able to scale any
resulting svg file? Sometimes my originating PDFs contain very large
images and are rather large for web viewing.

------------------------

A: PDF to SVG command-line does not include options to optimize/scale
embedded images, however you can use PDFNet SDK (http://
www.pdftron.com/pdfnet) to optimize the document (using
pdftron.PDF.Optimizer) prior to export to SVG
(pdftron.PDF.Convert.ToSVG).

For example of how to use PDF Optimizer, please see Optimizer sample
project:
http://www.pdftron.com/pdfnet/samplecode.html#Optimizer

For example of how to convert PDF to SVG and other formats, please
Convert sample:
http://www.pdftron.com/pdfnet/samplecode.html#Convert

Together the code would be along the following lines (in C#, other
languages are similar):

using (PDFDoc doc = new PDFDoc("my.pdf")) {
doc.InitSecurityHandler();

Optimizer.ImageSettings image_settings = new
Optimizer.ImageSettings();

image_settings.SetCompressionMode(Optimizer.ImageSettings.CompressionMode.e_jpeg);
image_settings.SetQuality(1);
image_settings.SetImageDPI(144,96);
image_settings.ForceRecompression(true);
Optimizer.Optimize(doc, image_settings,image_settings);

pdftron.PDF.Convert.ToSvg(doc, "mysvg")
}


Reply all
Reply to author
Forward
0 new messages