PDF to SVG converter - Question on clipping

Q:
I have couple of questions regarding the clipping part of the pdf to svg conversion.

We got the page clipping to work by passing cropbox co-ordinates for the element we want to clip on a page, but it seems like the converter converts the entire page and clips based on the coordinates showing the viewport but retaining all other information on the page. This increases the file size significantly and also have a lot of unwanted information. How do we avoid this? Is there a way you can only output the cropbox area to svg?

Also, from the documentation, it seems like the CMD line converter was last updated back in 2010. Do you guys have a newer version available?

A:

We got the page clipping to work by passing cropbox co-ordinates for the element we want to clip on a

page, but it seems like the converter converts the entire page and clips based on the coordinates

showing the viewport but retaining all other information on the page. This increases the file size

significantly and also have a lot of unwanted information. How do we avoid this? Is there a way you

can only output the cropbox area to svg?

The solution would be to perform pre-processing on PDF prior to conversion to SVG.

You can achieve this using PDFNet Core API along with Convert Add-on (to convert to SVG).

Basically you would:

  • open a document and change the crop box on all pages with page.SetCropBox(rect).

  • use approach shown in ElementEdit sample to remove unwanted elements (i.e. elements whose element.GetBBox() does not intersect the crop box):

http://www.pdftron.com/pdfnet/samplecode.html#ElementEdit

  • export the page to SVG using pdftron.PDF.Convert.ToSvg() - see Convert sample project.

Also, from the documentation, it seems like the converter was last updated …

The documentation may have been updated last time in 2010 (since there were no changes in the command line interface), however we are frequently releasing new versions. The last version was just released in May.