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
Hi,
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???
Marc
Hi Marc,
Hi,
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
tmp.getPages().add(page);
// 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.
Marc
Hi Marc,
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.