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
- Single and multipage views
- Search and navigation
- Customisable UI and L & F
- Simple to Localize
- Programmable API
- 3 lines of code to add
Rasterize
- PDF to BufferedImage
- PDF to AVIF (Soon)
- PDF to JPEG/JPEG2000
- PDF to HEIC
- PDF to PNG
- PDF to TIFF
- PDF to WEBP
Print PDF
- Client and server printing
- Full JPS support
- Define multiple paper sizes
- Page scaling / rotation
- All Acrobat output options
- Page ranges
- Fast draft print mode
Process Documents
- Digital signing
- Extract embedded files
- Merge
- Optimize
- Remove unused objects
- Sanitize
- Split
Extract Content
- Images
- Marked / Structured content
- Metadata
- Outlines
- Raw text
- Text search
Interaction
- Annotations
- AcroForms
- XFA Forms
- Add/delete/edit/read values
- Access raw form data
- Read raw XFA data
PDF Inspector
- COS tree
- Object dictionaries
- Decoded / raw stream data
- Outlines
- Raw text
- Single step debugging
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)
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)