DOCX JPG PDF XML PDF
java  Product Family
XML

Convert PDF to XML via Java

Read, Write and Convert PDF to XML using native Java library without needing Adobe.

How to Convert PDF to XML using Java

In order to render PDF to XML, we’ll use Aspose.PDF for Java API which is a feature-rich, powerful and easy to use conversion API for Java platform. You can download its latest version directly from Maven and install it within your Maven-based project by adding the following configurations to the pom.xml.

Repository


<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>

Dependency

<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>version of aspose-pdf API</version>
<classifier>jdk17</classifier>
</dependency>

Steps to Convert PDF to XML via Java

Java developers can easily convert PDF file to XML in just a few lines of code.

  1. Load PDF file with an instance of Document
  2. Call Document.save method while passing the output file path & SaveFormat as parameters
  3. XML file will be saved at the specified path

System Requirements

Before running the Java conversion example code, make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with Java Runtime Environment for JSP/JSF Application and Desktop Applications.
  • Get latest version of Aspose.PDF for Java directly from Maven.
 

PDF to XML Java Conversion Source Code

// load PDF with an instance of Document
Document document = new Document("template.pdf");
// save document in XML format
document.save("output.xml", SaveFormat.Xml);

 
  • PDF to XML Conversion Live Demos