Page 1 of 1

Adding a blank page to an existing PDF

Posted: 2016-09-02T14:52:25-07:00
by KingBahb
Version: ImageMagick 6.9.2-5 Q16 x64 2015-10-31
Platform: Windows

From the command-line I'm trying to create and append a blank page to an existing PDF, and maintain existing print quality. Here's the command I am using:

Code: Select all

convert -density 300x300 -compress JPEG 4Page.pdf ( xc:none -page A4 ) -adjoin Final.pdf
This creates a 5 page PDF just fine (with a blank page as the last page). The issue I'm having is that the pages of the 4Page.pdf file are getting resized; I don't want that. I want the 4Page.pdf pages to retain their pre-converted page size.

The 4Page.pdf has the following abbreviated properties (with slight variations between each page, except for Resolution):

Geometry: 597x846+0+0
Resolution: 72x72
Print size: 8.29167x11.75

The Final.pdf looks like this:

Geometry: 143x202+0+0
Resolution: 72x72
Print size: 1.98611x2.80556

So, I'm doing something wrong with the -density argument. I tried -density 72x72 (to match the 4Page.pdf setting), but the Final.pdf quality was horrible. Here are the properties of EVERY page with that setting:

Geometry: 595x842+0+0
Resolution: 72x72
Print size: 8.26389x11.6944

Thoughts? I'm somewhat new to using ImageMagick. Any suggestions are appreciated.

Re: Adding a blank page to an existing PDF

Posted: 2016-09-02T15:57:53-07:00
by snibgo
IM is a raster image processor. If your PDF contains vector data (like simple text), it is the wrong tool for this job because it will rasterize every page (convert it to pixels), then write all those raster images to new pages. With appropriate density settings (which might be 300 or 600) the quality may be okay, but PDF will no longer be searchable for text, etc.

Re: Adding a blank page to an existing PDF

Posted: 2016-09-09T09:25:57-07:00
by KingBahb
Searchable text in the PDF is not a requirement, so I'm okay with using IM to do this. I guess I will play with the density settings to see if I can find an acceptable output. Thanks!

Re: Adding a blank page to an existing PDF

Posted: 2016-09-09T10:25:38-07:00
by GeeMack
KingBahb wrote:

Code: Select all

convert -density 300x300 -compress JPEG 4Page.pdf ( xc:none -page A4 ) -adjoin Final.pdf
This creates a 5 page PDF just fine (with a blank page as the last page). The issue I'm having is that the pages of the 4Page.pdf file are getting resized; I don't want that. I want the 4Page.pdf pages to retain their pre-converted page size
I ran into a similar issue when adding a page from one PDF to the end of another. Try doing "-density 300x300" before you bring in the first PDF, and doing "-density 72x72" at the end before the output filename. Something like this...

Code: Select all

convert -density 300x300 -compress JPEG 4Page.pdf ( xc:none -page A4 ) -adjoin -density 72x72 Final.pdf
Higher density settings before the input PDF will result in better quality output, take longer, and make larger output files.