Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PDF file that needs a blank page inserted into it every so often. The pattern is unpredictable, so I need a command that will allow me to fit one in wherever necessary.

How can i do this?

share|improve this question
up vote 8 down vote accepted

From http://blog.chewearn.com/2008/12/18/rearrange-pdf-pages-with-pdftk/

pdftk A=src.pdf B=blank.pdf cat A1 B1 A2-end output res.pdf

Hope you like this script, just save it as pdfInsertBlankPageAt.sh, add execute permissions, and run.

./pdfInsertBlankPageAt 5 src.pdf res.pdf

if [ $# -ne 3 ]
  echo "Usage example: ./pdfInsertBlankPageAt 5 src.pdf res.pdf"
  exit $E_BADARGS
  pdftk A=$2 B=blank.pdf cat A1-$(($1-1)) B1 A$1-end output $3

cat A1 B1 A2-end means that the output file will contain the first page of document A (src.pdf) followed by the first page of document B (blank.pdf) followed by the rest (pages 2 to end) of document B. This operation is called concatenation, Linux cat is very often used to display text, but it is interesting when used with more than one argument.

To create blank.pdf, see Can I create a blank PDF from the command line?

share|improve this answer
I suggest adding a small explanation what the command does, what effect it has (e.g. where the blank page is inserted). Also you could add a convenient way how to create a pdf file with only a blank page in it. – maxschlepzig Jul 3 '11 at 15:22
thanks. i used your answer successfully. – ixtmixilix Jul 7 '11 at 21:39
I found today the following command to create a blank page using the command line: echo "" | ps2pdf -sPAPERSIZE=a4 - pageblanche.pdf – remjg May 31 '14 at 17:42
Link is dead :( – Weboide Dec 9 '14 at 22:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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