How to Convert PDF to PDF/A in Java

<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.pdf.free</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
import com.spire.pdf.conversion.PdfStandardsConverter;

public class ConvertPdfToPdfA {
public static void main(String[] args) {

//Specify input file path
String inputFile = "C:/Users/Administrator/Desktop/sample.pdf";

//Specify output folder
String outputFolder = "C:/Users/Administrator/Desktop/Output/";

//Create a PdfStandardsConverter instance, passing in the input file as a parameter
PdfStandardsConverter converter = new PdfStandardsConverter(inputFile);

//Convert to PdfA1A
converter.toPdfA1A(outputFolder + "ToPdfA1A.pdf");

//Convert to PdfA1B
converter.toPdfA1B(outputFolder + "ToPdfA1B.pdf");

//Convert to PdfA2A
converter.toPdfA2A(outputFolder + "ToPdfA2A.pdf");

//Convert to PdfA2B
converter.toPdfA2B(outputFolder + "ToPdfA2B.pdf");

//Convert to PdfA3A
converter.toPdfA3A(outputFolder + "ToPdfA3A.pdf");

//Convert to PdfA3B
converter.toPdfA3B(outputFolder + "ToPdfA3B.pdf");
}
}

--

--

--

Sharing Java Code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

BraveWay Car Lights LED H7 16000LM H11 LED Lamp for Car Headlight Bulbs H4 H1 H8 H9 9005 9006 HB3…

Getting Started With Apache Kafka

Decompose Form Request in Laravel

What is a C static library?

Lubbock teen wins national coding award

GNU manipulation tools installation and working

Create a basic dashboard in Tableau using MySQL

Installing python dependencies using wheels

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Wilson

Andrew Wilson

Sharing Java Code

More from Medium

Building CRUD REST APIs using Spring Boot & Couchbase Server (NoSQL) with basic validations

Parameterized Tests Using JSON File As Input Source

HTTPS and Spring boot

How to Validate a PNG File with Java