Convert PDF to SVG in Java

Spire.PDF for Java API provides the ability to easily and efficiently convert PDF to a variety of file formats. In this article, we'll explain how to convert a PDF file to SVG (Scalable Vector Graphics) format using Spire.PDF for Java.

The example PDF file:

Convert PDF to SVG in Java

import com.spire.pdf.*;

public class PDFConversion {
    public static void main(String[] args) {
        //Load the PDF file
        PdfDocument pdf = new PdfDocument();
        pdf.loadFromFile("Input.pdf");
        //Save to SVG image
        pdf.saveToFile("ToSVG.svg", FileFormat.SVG);
        pdf.close();
    }
}

The output SVG file:

Convert PDF to SVG in Java