Manipulate PDF pages

Add, Copy, Delete, Resize pages in an existing PDF Document

How to Manipulate PDF Pages in Java

final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
pdf.addPage(1, PaperSize.A4_LANDSCAPE);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
pdf.copyPage(1, 2);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
pdf.removePage(1);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
pdf.scalePage(1, 0.5f, 0.5f);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
// Arrange pages 1-10 in a 2x2 grid using as many pages as necessary.
pdf.nUp(new PageRanges(1, 10), 2, 2);
// Arrange pages 1-10 in a 2x2 grid using as many pages as necessary with a scaling factor of one half.
pdf.nUp(new PageRanges(1, 10), 2, 2, 0.5f);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
final Annotation[] annotations = new Annotation[2];
// Text box annotation with size 12 TimesNewRoman font red color and center aligned text.
annotations[0] = new FreeText(new float[] {400, 600, 500, 700}, "hello!", new float[] {1.0f, 0.0f, 0.0f}, BaseFont.TimesRoman, 12, Quadding.CENTRED);
// Hyperlink annotation with blue color.
annotations[1] = new Link(new float[] {200, 600, 300, 700}, new float[] {0.0f, 0.0f, 1.0f}, "https://idrsolutions.com/");
pdf.addAnnotation(1, annotations);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
final BufferedImage img = new BufferedImage();
pdf.addImage(1, img, new float[] {0, 0, 100, 100});
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));
final PdfManipulator pdf = new PdfManipulator();
pdf.loadDocument(new File("inputFile.pdf"));
pdf.addText(1, "Hello World", 10, 10, BaseFont.HelveticaBold, 12, 1, 0.3f, 0.2f);
pdf.apply();
pdf.writeDocument(new File("outputFile.pdf"));

PDF Manipulation Features

JPedal comes with a powerful PDF Manipulator Java API that can do the following things:

  • Add images
  • Add pages
  • Add text
  • Attach/embed files
  • Copy pages
  • Isolate pages
  • N-up
  • Remove embedded files
  • Remove JavaScript
  • Remove metadata
  • Remove pages
  • Rotate pages
  • Scale pages
  • Scale page content
  • Split pages

JPedal is a complete Java toolbox for working with 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
Learn more
Rasterize
  • PDF to BufferedImage
  • PDF to AVIF (Soon)
  • PDF to JPEG/JPEG2000
  • PDF to HEIC
  • PDF to PNG
  • PDF to TIFF
  • PDF to WEBP
Learn more
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
Learn more
Process Documents
  • Digital signing
  • Extract embedded files
  • Merge
  • Optimize
  • Remove unused objects
  • 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
  • Annotations
  • AcroForms
  • XFA Forms
  • Add/delete/edit/read values
  • Access raw form data
  • Read raw XFA data
Learn more
PDF Inspector
  • COS tree
  • Object dictionaries
  • Decoded / raw stream data
  • 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)