34

I want to find out the easiest way to replace a single page in a multiple page PDF with another single page PDF in Linux. What tool is best for this?

Currently I do it like this:

  1. split pdf to single pages using pdfsam
  2. replace the pages that I want to replace
  3. merge them using pdfsam
  4. use ghostscript to force the page size as same

Any better way?

58

You could use the PDF Toolkit PDFtk:

Example:

pdftk A=inA.pdf B=inB.pdf cat A1-12 B3 A14-end output out1.pdf

The output consists of the first 12 pages of inA.pdf, followed by page 3 of inB.pdf and then pages 14 until end of inA.pdf.

Many Linux distributions provide a PDFtk package you can download and install using their package manager.

  • 2
    Thanks! Note, A= and B= must be uppercase. When I tried lowercase pdftk though a= was part of the filename. – biscuit314 Oct 9 '17 at 13:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.