Process PDF Documents

Optimize, Merge, Sign, Split an existing PDF Document

How to Process PDF Files in Java

// Remove unused objects and optimize PDF files
PdfOptimizer.optimizePDF(new File("inputFile.pdf"), new File("outputFile.pdf"));
// Merge two files into a single file
PdfMerge.mergeFiles(new File("inputFile1.pdf"), new File("inputFile2.pdf"), new File("outputFile.pdf"));

// Merge an array of PDFs into a single file
PdfMerge.mergeFiles(new File[]{new File("inputFile.pdf"), ...}, new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
// Remove attachments and embedded files
pdf.removeEmbeddedFiles();
// Remove scripts and code
pdf.removeJavaScript();
// Remove document information and metadata
pdf.removeMetadata();
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
// Digitally sign a PDF file
PdfSigner.signPdf(
        "inputFile.pdf",
        "outputFile.pdf",
        "keystorePassword",
        "keystoreFile.p12",
        "signerName",
        "signerLocation",
        "signingReason",
        ACCESS_PERMISSION.P1
);
// Split a PDF file into two files where the first page contains pages 1-pageToSplitAt inclusive, the second contains all other pages
PdfManipulator.splitInHalf(new File("inputFile.pdf"), new File("outputFolder"), pageToSplitAt);

// Split all pages into separate PDF files, all output has the same file name with the page numbers appended
PdfManipulator.splitIntoPages(new File("inputFile.pdf"), new File("outputFolder"), numberOfPages);

Use JPedal as part of your PDF document workflow

JPedal contains lots of functions to process PDF files which you can set up to automate your workflow:

  • Add, copy, or delete pages
  • Annotate pages
  • Digitally sign PDF files
  • Extract embedded content
  • Extract images/text
  • Optimize documents
  • Sanitize documents
  • Split and merge documents

JPedal is a complete Java toolkit for processing PDF Documents

Java Viewer
  • 100% Java PDF and Image Viewer
  • Customisable UI and L & F
  • Programmable API
  • Search and navigation
  • Single and multipage views
  • Simple to Localize
  • 3 lines of code to add
  •  
Learn more
Rasterize
  • PDF to BufferedImage
  • PDF to AVIF
  • PDF to HEIC
  • PDF to JPEG/JPEG2000
  • PDF to PNG
  • PDF to TIFF
  • PDF to WEBP
  •  
Learn more
Print PDF
  • All Acrobat output options
  • Client and server printing
  • Define multiple paper sizes
  • Fast draft print mode
  • Full JPS support
  • Page ranges
  • Page scaling / rotation
  •  
Learn more
Process Documents
  • Digital signing
  • Extract embedded files
  • Encrypt
  • Merge
  • Optimize / remove unused objects
  • Redact text
  • Sanitize
  • Split
Learn more
Manipulate Pages
  • Add
  • Copy
  • Delete
  • N-up
  • Remove
  • Resize
  •  
Learn more
Extract Content
  • Images
  • Marked / Structured content
  • Metadata
  • Outlines
  • Raw text
  • Text search
  •  
Learn more
Interaction
  • Access raw form data
  • AcroForms
  • Add/delete/edit/read values
  • Annotations
  • Flatten layers
  • Read raw XFA data
  • XFA Forms
Learn more
PDF Inspector
  • COS tree
  • Decoded / raw stream data
  • Object dictionaries
  • Outlines
  • Raw text
  • Single step debugging
  •  
Learn more

JPedal has the advantage of running in the same Java virtual machine, so we save a lot of CPU resources.

- T. Büngener (Software Architect InSign)

Who else uses JPedal?

Adobe logo
Jive logo
Interwork logo
Abacus logo
DigiSigner logo
Stampli logo
Versitech logo
InSign logo

JPedal is absolutely easy to use and it provided the best results of all libraries we tested over the years. We need to create renditions of PDF files so that people can view them conveniently in the browser.

- Roman K. (Developer at German Digital Big Data Platform)


Support for JPedal is done extremely well and for continuously using the software, what the customer needs is good support for the issues we face. And it is superb in that respect.

- Developer (Large Multinational Corporation)