3

I have a free PDF book on which every page has a very large margin on the right-side. I would like to print it two-sided and bind it to a book using an online printing service. The problem is that I would need to move the content of each odd numbered page to the right for this to work better.

I don't have access to the TeX source that generated the file and the authors are not providing it, so I can't recompile it for two-sided printing. I'm happy with any solution that works on either Linux or OS X.

For anyone interested, the file is this: http://infolab.stanford.edu/~ullman/mmds/book.pdf

EDIT: After some tinkering I did it with the following method:

  1. I first split the pdf into two files of odd/even pages using pdftk.

  2. Using Skim I measured the size of the left margin which was 72pts.

  3. Using Skim's select tool, I picked a 72pt margin on the left for the odd pages and on the right for the even pages with a total width of 450 points. To keep A4 proportions, I chose 636 pts as the height of the bounding box and made it fit the document. Finally, I cropped the even/odd files to their corresponding boxes.

  4. Merged the files using pdftk.

  5. Open the file in OS X Preview, opened the print dialog, chose save as PDF, chose A4 as paper size and scale to fit the page.

Had been nicer to do this from the command line, since using a calculator to calculate the coordinates is much quicker than trying to get the bounding boxes with the correct coordinates. From some reason Skim doesn't show you the coordinates of the cursor in the status bar before you have chosen the first point for the selection.

4

Method #1 - pdfcrop

There's a command line tool called pdfcrop that sounds like what you're looking for.

pdfcrop is a utility to calculate and remove empty margins from each page in the input PDF file. The resulting output file occupies the minimal paper size needed for the contents and is therefore suitable for inclusion as a graphic

Examples
$ pdfcrop --margins 10 input.pdf output.pdf
$ pdfcrop --margins ’5 10 5 20’ --clip input.pdf output.pdf

Method #2 - pdfjam

As an alternative there's another tool called pdfjam.

$ pdfjam --twoside --offset '2cm 0cm' file.pdf

References

  • 2
    pdfcrop doesn't seem to look for a shared bounding box for the pages, but computes one for each page separately. Therefore, you end up with a bunch of pages of different sizes. – Edvard Fagerholm Oct 27 '14 at 12:22

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.