Link
Skip to main content

How to setup in NetBeans

JPedal is a Java PDF library that allows developers to view, print, rasterize and extract content from PDF files in their own Java applications.

This tutorial will show you how to set up a project and start using JPedal in NetBeans.

Please note: A trial or full copy of the JPedal jar is needed. You can download the trial jar from here.

Step 1 - Download and install NetBeans:

If you haven’t already, go to NetBeans website and download the latest version of NetBeans:

NetBeans official website

Step 2 - Create a project:

Once installed, open up NetBeans. Go to ‘New project’ then create a Java application with Ant. (This will give you all the basics you need and is great for when starting out with JPedal) Click ‘Next’ and name your project, then click ‘Finish’.

create a project

Create a ‘lib’ directory in the project to store dependencies.

Step 3 - Clone the repository:

Go to GitHub repository of our example and click on ‘Code’.

clone repository

Either:

  • Copy the URL under ‘Clone with HTTPS’
    Then in NetBeans, click on ‘Team’ → ‘Git’ → ‘Clone’
    clone repo on NetBeans
    And enter the URL

Or

  • Click ‘Download ZIP’ and extract the JPedalExamples.java file.

Finally, copy JPedalExamples.java into the ‘src’ folder of the project from Step 2.

Step 4 - Add JPedal dependency (trial or full version):

Now you have a project, find your copy of the JPedal jar file, add it to the ‘lib’ directory.

Right-click on your project and go to ‘properties’. Then go to ‘Libraries’, click the plus symbol and ‘Add JAR/Folder’.

project properties panel

Now go to the lib folder where the JPedal jar is, click on the jar, click ‘Open’, then click ‘OK’.

Step 5 - Start coding:

Now you can go ahead and start editing the coding, start by changing the parameters to fit your purpose. Ensure that you write out the whole input/output paths if not in the same directory:

public static void extractImages() throws PdfException {
    ExtractClippedImages.writeAllClippedImagesToDirs("inputFile.pdf",
          "outputFolder", "png", new String[]{"100", "fixedHeight"});
    }
}

After this, make sure to uncomment the method you’d like to use:

public static void main(String[] args) {
    try {
        pdfToImage();
//      pdfViewer();
//      extractWords();
//      extractImages();
    } catch (final Exception e) {
        e.print.printStackTrace();
    }
}

Now you can build your project and run it!

Want to add more to your project?

Check out the following tutorials for more information to see what JPedal can do for you:


Why JPedal?

  • Actively developed commercial library with full support and no third party dependencies.
  • Process PDF files up to 3x faster than alternative Java PDF libraries.
  • Simple licensing options and source code access for OEM users.

Learn more about JPedal

Start Your Free Trial


Customer Downloads

Select Download