Export single page to SVG

How can I export a single page to an SVG file?

Hi Marc,

Thanks for contacting support.

In order to accomplish your requirements, please extract/get particular page of PDF file (from pages collection of PDF file) and then try using SvgSaveOptions class to render input PDF to SVG format. For further details, please visit


Thanks for the quick answer. I have this working now. However, for some reason my saved file is placed in the parent folder, with a windows backslash in its name (!). For example, when I do this:

document.save("/Users/marc/Desktop/test.svg", saveOptions);

The resulting file is saved in the folder “/Users/marc” as “Desktop\test.svg”.

Seems like there is a hardcoded “” somewhere in your code, instead of File.separator???


Hi Marc,

Thanks for your inquiry. I have tested the scenario using Aspose.Pdf for Java 9.7.0 over Windows 7 64 bit and unable to replicate the issue. I am getting FileNotFoundException for non existence path. Can you please share your source code and system environments? so we will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,


I am not surprised you cannot reproduce this issue on Windows, since the backslash is valid path separator on Windows. We are on Mac and Linux, where the backslash gives problems.

Here is the code snippet:

// get the page from existing opened document:

final Page page = getPage(document, pageNumber);

// create a temporary Document object

final Document tmp = new Document();

// add the page to the Pages collection of new document object


// write the temporary document as svg:

final File tmpFile = new File("/Users/marc/Desktop/test.svg");

final SvgSaveOptions saveOptions = new SvgSaveOptions();

saveOptions.CompressOutputToZipArchive = false;

tmp.save(tempFile.getAbsolutePath(), saveOptions);

We use aspose-pdf-9.7.0-jdk16.jar on Java 7.


Hi Marc,

Thanks for sharing the details.

I have tested the scenario over Red Hat Enterprise Linux 5.6 with JDK 1.7.0_71 and as per my observations, the resultant file is not being generated (neither over path where I am executing code nor on system root path). I am unable to find/locate resultant SVG over my machine. However for the sake of correction, I
have logged and investigation ticket in our issue tracking system as PDFNEWJAVA-34649. We will investigate this
issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.