Link
Skip to main content

Manipulate PDF files from the command line

v2025.09

You can run the PdfManipulator from the command line using JPedal:

java -jar jpedal.jar --manipulate ...

Single operations

Perform one operation in a single pass. Each pass will write to disk.

--addImage inputFile (String) outputFile (String) pages (PageRanges) imageFile (String) imageBounds (float[])
--addPage inputFile (String) outputFile (String) pages (PageRanges) mediaBox (float[])
--addText inputFile (String) outputFile (String) pages (PageRanges) text (String) x (float) y (float) baseFontName (String) fontSize (int) r (color) g (color) b (color)
--addText inputFile (String) outputFile (String) pages (PageRanges) text (String) x (float) y (float) baseFontName (String) fontSize (int) r (color) g (color) b (color) a (color)
--attachFile inputFile (String) outputFile (String) pages (PageRanges) embeddedFile (String) fileName (String) annotationRect (float[]) annotationColor (color[]) annotationIcon (String)
--containsJavaScript inputFile (String)
--copyPage inputFile (String) outputFile (String) sourcePage (int) destinationPage (int)
--embedFile inputFile (String) outputFile (String) embeddedFile (String) fileName (String)
--getPageCount inputFile (String)
--getPageCropBox inputFile (String) pages (PageRanges)
--getPageMediaBox inputFile (String) pages (PageRanges)
--getPageRotation inputFile (String) pages (PageRanges)
--isolatePage inputFile (String) outputFile (String) pages (PageRanges)
--nUp inputFile (String) outputFile (String) pages (PageRanges) rows (int) columns (int)
--nUp inputFile (String) outputFile (String) pages (PageRanges) rows (int) columns (int) scaling (float)
--removeEmbeddedFiles inputFile (String) outputFile (String)
--removeJavaScript inputFile (String) outputFile (String)
--removeMetadata inputFile (String) outputFile (String)
--removePage inputFile (String) outputFile (String) pages (PageRanges)
--rotatePage inputFile (String) outputFile (String) pages (PageRanges) angle (int)
--setPageRotation inputFile (String) outputFile (String) pages (PageRanges) angle (int)
--scalePage inputFile (String) outputFile (String) pages (PageRanges) scaleX (float) scaleY (float)
--scalePageContent inputFile (String) outputFile (String) pages (PageRanges) scaleX (float) scaleY (float) translatePreset (int)
--scalePageContent inputFile (String) outputFile (String) pages (PageRanges) scaleX (float) scaleY (float) translateX (float) translateY (float)
--splitInHalf inputFile (String) outputFile (String) page (int)
--splitIntoPages inputFile (String) outputFile (String) pages (int)

See Manipulate PDF files in Java for a description of each operation.

Multiple operations

To reduce the amount of disk writes, you may chain together and perform multiple operations in a single pass. To achieve this, the first two options must be the input and output files, specified as follows:

--input inputFile (String) --output outputFile (String)

Alternatively, you can create a blank document:

--newDocument mediaBox (float[]) --output outputFile (String)

Then you can specify any of the operations listed below. They will be applied in the order you provide them.

--addImage pages (PageRanges) imageFile (String) imageBounds (float[])
--addPage pages (PageRanges) mediaBox (float[])
--addText pages (PageRanges) text (String) x (float) y (float) baseFontName (String) fontSize (int) r (color) g (color) b (color)
--addText pages (PageRanges) text (String) x (float) y (float) baseFontName (String) fontSize (int) r (color) g (color) b (color) a (color)
--attachFile pages (PageRanges) embeddedFile (String) fileName (String) annotationRect (float[]) annotationColor (color[]) annotationIcon (String)
--copyPage sourcePage (int) destinationPage (int)
--embedFile embeddedFile (String) fileName (String)
--isolatePage pages (PageRanges)
--nUp pages (PageRanges) rows (int) columns (int)
--nUp pages (PageRanges) rows (int) columns (int) scaling (float)
--removeEmbeddedFiles inputFile (String) outputFile (String)
--removeJavaScript inputFile (String) outputFile (String)
--removeMetadata inputFile (String) outputFile (String)
--removePage pages (PageRanges)
--rotatePage pages (PageRanges) angle (int)
--setPageRotation pages (PageRanges) angle (int)
--scalePage pages (PageRanges) scaleX (float) scaleY (float)
--scalePageContent pages (PageRanges) scaleX (float) scaleY (float) translatePreset (int)
--scalePageContent pages (PageRanges) scaleX (float) scaleY (float) translateX (float) translateY (float)

Types

The data types in the above commands are denoted in parentheses and are defined as follows:

  • String should be enclosed with speech marks, and use escaping where necessary
  • PageRanges should follow the SetOfIntegerSyntax, and be enclosed with speech marks
  • int should be a typical integer
  • float should be a typical float, the f suffix is optional
  • float[] should be four floats delimited with commas, do not enclose with square brackets
  • color should be a float in the range [0.0 - 1.0] inclusive
  • color[] should be one, three, or four color values which represents either gray, RGB, or CMYK, delimited with commas, do not enclose with square brackets

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