Java convert a multipage PDF to one SVG

2019-07-15 08:26:24 Written by  support iceblue
Rate this item
(0 votes)

In the article of convert PDF to SVG by Spire.PDF, each page on the PDF file has been saved as a single SVG file. For example, if the PDF contains 10 pages, we will get 10 SVG files separately. From version 2.7.6, Spire.PDF for Java supports to convert a multipage PDF to one single SVG file in Java.

import com.spire.pdf.*;


public class PDFtoSVG {
    public static void main(String[] args) throws Exception {

        String inputPath = "Sample.pdf";

        PdfDocument document = new PdfDocument();
        document.loadFromFile(inputPath);

        document.getConvertOptions().setOutputToOneSvg(true);

        document.saveToFile("output.svg", FileFormat.SVG);
        document.close();
    }
}

Effective screenshot of the resulted one SVG file:

Java convert a multipage PDF to one SVG

Additional Info

  • tutorial_title:
Last modified on Thursday, 02 September 2021 06:25