1

I'm trying to separately crop PDF's even and odd pages, by building on top of the accepted answer from How to crop odd and even pages differently in a PDF?

My Automator workflow, roughly:

  1. automatically Extract Odd & Even Pages; each output PDF filename is suffixed with "(Even Pages)" or "(Odd Pages)"
  2. pause Automator Workflow with Ask for Confirmation and manually crop each of the two output PDFs (using Rectangular Selection and Crop in Preview)
  3. select the two cropped PDFs using Get Folder Contents
  4. Combine PDF Pages with Shuffling pages option

The issue is step 4. which inevitably seems to drop any Crop from step 2. The combined PDF has no crop applied to it, even though the two even & odd input PDFs are definitely cropped.

Is this expected behaviour from Combine PDF Pages? PDF metadata and annotations do seem to get dropped, does Crop as well?

enter image description here

1
  • Also doesn't preserve any form text.
    – malhal
    Commented May 18, 2021 at 11:24

2 Answers 2

1

There is a package called pdfjoin which uses pdflatex to combine pdf files. You could try joining your pdf's in the following way:

pdfjoin 01.pdf 02.pdf

which will combine the files into a single pdf called 02-combined.pdf, in your current working directory.

If you don't have LaTeX installed you can follow this guide to do so.

This preserved crops for me when I tried. If you can get this working on your system, you could then maybe look at putting this together in a bash script.

1

Preview does not 'destructively' crop images. (It tells you as much when you crop a PDF.)

There are four different 'boxes' used to describe the page size of a PDF. When you crop a PDF in Preview, it alters the 'cropBox', but the entire page data is still there in the 'mediaBox', and it is this value that Automator uses to get the PDF pages.

The Combine Pages action uses (at its heart) a python script to combine the pages. This loads each page into a new CoreGraphics object, which is also why the metadata and annotations get dropped. It should be possible to create a script that uses the cropBox instead of mediaBox, and which preserves annotations.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .