Java/ Change PDF Version

<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.4.1</version>
</dependency>
</dependencies>
  1. Create a PdfDocument object.
  2. Load a sample PDF file using PdfDocument.loadFromFile() method.
  3. Change the PDF version using PdfDocument.getFileInfo().setVersion() method.
  4. Save the result file using PdfDocument.saveToFile() method.
package com.spire.pdf;

public class ChangePdfVersion {

public static void main(String[] args) {

//Create a PdfDocument object
PdfDocument document = new PdfDocument();

//Load a sample PDF file
document.loadFromFile("test.pdf");

//Change the PDF version to 1.6
document.getFileInfo().setVersion(PdfVersion.Version_1_6);

//Save to file
document.saveToFile("PdfVersion.pdf", FileFormat.PDF);
document.close();
}
}

--

--

--

Sharing Java Code

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

Recommended from Medium

Ripple Effect (Wave Effect) Button using HTML, CSS & Javascript

New to medium.

Deploying React apps with Amplify

From a multi page application to a single page application

How to make lazy loading actually work in Vue (CLI 3)

Framework Wars 2019 (Both CSS and JS Frameworks)

Should I Upgrade to React 17?

Set a Time Limit on Async Actions in JavaScript

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

Java Inner Example -10 Program

Objects in Java

Logging in Java

JAVA & Git-Hub