How do I overlay or stamp one PDF document with another from Command Line with VeryUtils Java PDF Toolkit (jpdfkit)?

Overlaying PDF Files. The contents of two or more PDF files can be overlaid by VeryUtils Java PDF Toolkit (jpdfkit).

This is a quick and relatively simple way to overlay one page onto another. This is sometimes called stitching, overlaying, watermarking, etc., although each of those terms can refer to slightly different tasks as well.

The benefit of overlaying one page onto another the way I've outlined below is that you don't have to render either of the pages as an image, so in the final output, you'll still be able to select individual elements on the page, including text.

Recently, I received a question from a customer,
I have two separate pdf files, each 50 pages. I want to overlay one file on top of the other one, with the output being a single pdf document of 50 pages, with the content of the two pdfs overlayed page-wise.

I don't want the same page of document 2 as the background of document 1, but each page should merge. i.e page one of pdf 1 merge with page one of pdf 2, page two of pdf 1 merge with page two of pdf 2, etc.
This is a good question, because PDF overlay is a high frequency requirement. This customer wants to overlay all pages from PDF 1 to PDF 2. VeryUtils Java PDF Toolkit (jpdfkit) software has this function, he can do this work with pdf files using the jpdfkit command line tool using the stamp or background option.

java -jar jpdfkit.jar file1.pdf background file2.pdf output combinedfile.pdf

This will only work with a one-page background file. If you have multiple pages, you can use the multistamp or multibackground command instead,

java -jar jpdfkit.jar file1.pdf multistamp file2.pdf output combinedfile.pdf

java -jar jpdfkit.jar file1.pdf multibackground file2.pdf output combinedfile.pdf

Here you can see an example for a cover page:


Single page  with picture elements + First page of a multi-page document = Cover page of resulting PDF file

Please following me to test PDF overlay function in VeryUtils Java PDF Toolkit (jpdfkit) software,

1. Please download VeryUtils Java PDF Toolkit (jpdfkit) from this web page,

2. Please make sure the Java is installed in your system, if not, please download and install Java JRE from this web page,

3. After you download the Java and VeryUtils Java PDF Toolkit (jpdfkit), please run a CMD window first, and run following command line in this CMD window,

java -jar jpdfkit.jar

You will see the command line options,


java -jar jpdfkit.jar sample_in2.pdf multistamp sample_fillform.pdf output "_muloverlay_out.pdf"

java -jar jpdfkit.jar "sample_fillform.pdf" multibackground sample_in2.pdf output "_mulunderlay_out.pdf"


jpdfkit.jar is a Java Archive, it can be run on Windows, Mac and Linux systems. PDF Java Toolkit is a native Java library for mission critical PDF workflows.

Automate business workflow with PDF Java Toolkit

VeryUtils PDF Java Toolkit is a native Java library that provides high-level APIs for automating PDF workflows like processing PDF forms, split and merge PDF pages, stamp and overlay PDF pages, etc. While written with Java developers in mind, VeryUtils PDF Java Toolkit can be used with any JVM language (Clojure, Scala, Groovy, etc.) and if you ever need help, our enterprise support team is only an email or phone call away!

VeryUtils PDF Java Toolkit Features:
Developers can use the PDF Java Toolkit to build applications with functionality, such as:
* Generate barcode appearances.
* Overlay PDF pages.
* Digitally sign a PDF (available upon request).
* Split and Merge PDF files.
* PDF portfolios.
* Reader enabling/extending PDFs.
* Redaction of PDFs.
* Use JavaScript inside of a PDF.
* Process PDF forms.
* Overlay page content onto another page.
* Sanitize PDF documents.
* Encrypt and Decrypt PDF files.
* Create page spreads in a PDF.

More information:

No votes yet.
Please wait...

Related Posts

Leave a Reply

Your email address will not be published.