In everyday life and work, the device we use is now a PDF version Is it often the case that strict conditions are required? In such a case, I think you need to convert the PDF version to fit the device. So, in this article, I will explain how to convert PDF version using Free Spire.PDF for Java (PDF version 1.0-1.7 can be converted).
** Import JAR package ** ** Method 1: ** After downloading and unzipping Free Spire.PDF for Java, in the lib folder Import the Spire.Pdf.jar package as a dependency into your Java application.
** Method 2: ** After installing the JAR package directly from the Maven repository, configure the pom.xml file as follows:
<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>3.9.0</version>
</dependency>
</dependencies>
** Java sample code: **
package com.spire.pdf;
public class ChangePdfVersion {
public static void main(String[] args) {
//Create a PdfDocument object
PdfDocument document = new PdfDocument();
//Import a PDF document
document.loadFromFile("test.pdf");
//PDF version 1.Change to 6
document.getFileInfo().setVersion(PdfVersion.Version_1_6);
//Save the document
document.saveToFile("ChangePdfVersion.pdf", FileFormat.PDF);
document.close();
}
}
** Completion example: **
Recommended Posts