2

Lulu is a print on-demand service. Part of the creation process is to upload a cover. The "cover" is 1 page that has the dimensions 17.25 inches wide by 11.25 inches high. There is a 0.125 "bleed area" on all edges that will be cut off after printing. Excluding the bleed, the left 8.5 inches is the back cover and the right 8.5 inches is the front cover. See the image below for a visual aide.

I have a 1 page pdf called cover-page.pdf on letter paper that I want to use as the front cover.

$ pdfinfo cover-page.pdf | grep Size
Page size:      612 x 792 pts (letter)

Using only open source command line tools, I want to create a new file, cover.pdf, from cover-page.pdf per the specification above by "placing" it in the right side of cover template.

Lulu Cover

I have investigated using pdftk, ImageMagick, and ghostscript. After reading the commands available for pdftk, that appears to be the wrong tool. I tried using ImageMagick and crafted the following:

 convert cover-page.pdf \
   -background white -gravity SouthEast -extent 1233x801 \
   -background white -gravity None -extent 1242x810 \
   cover.pdf

This worked, but it uses raster transformations.

The last thing I looked into was Ghostscript. I am the least confident in my ghostscript abilities, but I did make some progress. I managed to create a blank pdf with the correct dimensions using gs -sDEVICE=pdfwrite -o cover.pdf -dDEVICEWIDTHPOINTS=1242 -dDEVICEHEIGHTPOINTS=810. However, as soon as I add -dPDFFitPage -f cover-page.pdf to process the file, the page size becomes 810 x 1048.24 and the page rotates. I assume this is to "fit" the aspect ratio of cover-page.pdf. So, my final (unsuccessful) command is:

gs \
  -sDEVICE=pdfwrite -o cover.pdf \
  -dDEVICEWIDTHPOINTS=1242 -dDEVICEHEIGHTPOINTS=810 \
  -dPDFFitPage -f cover-page.pdf
2
+50

pdfjam, a tool that comes in TeX distributions like Texlive, will do the trick. The command will be

pdfjam -o cover.pdf --papersize '{17.25in,11.25in}' --noautoscale true --nup 2x1 cover-page.pdf '{},1'

pdfjam relies on the LaTeX pdfpages package. By default it puts one input page per output page, scales input to fit the paper, and centers it. Here, --nup 2x1 instructs to put two input pages per output page, and --noautoscale true, not to scale (as you may have guessed!). As input pages I used a blank page ({}) and the first page of the input document (1); by default no spacing is added between input pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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