Command Line – How to Create a Blank PDF

command linepdf

I recently needed a single blank PDF page (8.5" x 11" size) and realized that I didn't know how to make one from the command line.

Issuing touch blank.pdf produces an empty PDF file. Is there a command line tool that produces an empty PDF page?

Best Answer

convert, the ImageMagick utility used in Ketan's answer, also allows you to write something like

convert xc:none -page Letter a.pdf

or

convert xc:none -page A4 a.pdf

or (for horizontal A4 paper)

convert xc:none -page 842x595 a.pdf

etc., without creating an empty text file. @chbrown noticed that this creates a smaller pdf file.

"xc:" means "X Constant Image" but could really be thought of as "x canvas". It's a way to specify a single block of a color, in this case none. More info at http://imagemagick.org/Usage/canvas/#solid which is the "de facto" manual for ImageMagick. [supplemented with information from pipe] (Things like pdf:a can be used to explicitly declare the format of a file. label:'some text', gradient:, rose: and logo: seem to be other examples of special file formats.)

Anko suggested posting this modification as a separate answer, so I am doing it.

Related Question