Foxit PDF SDK Java Library
This section describes how to use the Foxit PDF SDK Java library to run examples and create a basic Java project. The project demonstrates rendering the first page of a PDF document to a bitmap and saving it as a JPG image.
Prerequisites
Development environment
- JDK ≥ 1.8:ensure
JAVA_HOMEis configured correctly and the JDKbindirectory is on yourPATH. - Foxit PDF SDK Java library: Request a trial via the Foxit Developer Hub. Download and install the library that matches your OS and architecture.
Supported platforms
We provide detailed system support information for Windows, Linux, and Mac, including operating system versions and compiler requirements. Select your platform for details.
Windows Linux MacRunning examples
Running examples from the command line
See Examples, which includes an overview of the sample projects, dependency information for specific examples, and how to run examples from the command line.
Running examples in Eclipse IDE
To keep the release package size small, Foxit does not include Eclipse sample projects. To run examples in Eclipse IDE, follow these steps:
- Create a Java project in Eclipse, then follow steps 1) and 3) under Creating a project in Eclipse IDE below to integrate the SDK library into the project.
- Copy the Java file for the example you want to run into the project. For example, for the
image2pdfdemo, copyimage2pdf.javafrom the\examples\simple_demo\image2pdfdirectory into the project'ssrcfolder. - Open the Java file and update the
output_pathandinput_pathas needed. For example, if you use the default test files referenced in the code, use absolute paths pointing to theoutput_filesandinput_filesfolders under theexamples\simple_demodirectory. - Run the example. Right-click the project and select Run As → Java Application.