相关文章推荐
礼貌的稀饭  ·  Reactor 之 flatMap vs ...·  1 年前    · 
飘逸的苹果  ·  UT000010: Session is ...·  1 年前    · 
爱笑的茶壶  ·  c# - Why does ...·  1 年前    · 

PDFBox Environment Setup

PDFBox Installation

To install PDFBox, perform the following steps-

Step 1. Open the Homepage of Apache PDFBox .

https://pdfbox.apache.org/

Step 2. Click on Download link. PDFBox download page is shown in the following screenshots.

Step 3. In the download page, click on the latest release . For Instance, we choose PDFBox 2.0.9 . Click on this release, we will be directed to the required JAR files as shown in the following screenshots.

Step 4. Download the following JAR files pdfbox-app-2.0.9.jar , pdfbox-2.0.9.jar , fontbox-2.0.9.jar , preflight-2.0.9.jar , xmpbox-2.0.9.jar and, pdfbox-tools-2.0.9.jar .

PDFBox Installation in Eclipse

The downloaded JAR files is required to embed into the Eclipse environment. We can do this by setting the build path and by using the pom.xml file.

Follow the below steps to install PDFBox in Eclipse-

Step 1. Open Eclipse IDE . Go to File->New->Java Project .

Step 2. A new Java Project Wizard will open. Fill the details and click Next .

Step 3. A new Java Project is created. Right click on this Project and select Build Path->Configure Build path. Following screen will open.

Step 4. Click Add External JARs . Select the JAR file which we had downloaded above and click Ok .

Step 5. After clicking Ok button, the JAR file will be added in our Library as shown in the following screenshot.

Step 6. Once we click Ok , JAR file successfully added in the current project. We can verify these libraries by expanding the Referenced Libraries as shown in the following screenshot.

Using pom.xml

1. Convert the Java Project into Maven Project . To do this, Right click on the Project -> Submenu Configure -> Convert to Maven Project .

2. Add the following components to its pom.xml .

<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>PDFDemoProject</groupId> <artifactId>PDFDemoProject</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.7.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox</artifactId> <version>2.0.9</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>fontbox</artifactId> <version>2.0.9</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>jempbox</artifactId> <version>1.8.14</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>xmpbox</artifactId> <version>2.0.9</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>preflight</artifactId> <version>2.0.9</version> </dependency> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox-tools</artifactId> <version>2.0.9</version> </dependency> </dependencies> </project> Next Topic PDFBox Create First PDF Document