Java/ Change PDF Version

  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

//Change the PDF version to 1.6

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




Sharing Java Code

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

Recommended from Medium

Movement, refined

JavaScript “use strict”

Top 33 JavaScript Projects on GitHub (November 2021)

Server-side Development with NodeJS

Uploading files in nodejs using fortjs

CombineLatest vs withLatestFrom

Storybook with React, Redux, and Material UI

New Markdown dialect “RichMD” has been released

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

AWS EC2 with Spring Boot Java — Part 1

Decode Base64 String to File in Java

Why spring boot is the famous framework for developing REST APIs in Java

Annotations in SpringBoot