Main Menu

Export PDF Crop

Started by jrap1000, August 16, 2021, 06:25:56 PM

Previous topic - Next topic

jrap1000

Hi,

I am trying to work out how to export all crop sizes from a directory containing multiple separate PDFs to a CSV, so that in column A it would state the filename, and then in the following column/columns the crop/cropbox sizes. For example:

Column A              Column B.
Filename               CropBox   
examplefile1.pdf    CropBox = [0,0,612,792]
examplefile2.pdf    CropBox = [0,0,612,792]
examplefile3.pdf    CropBox = [0,0,612,792]
examplefile4.pdf    CropBox = [0,0,612,792]

I am not sure this is even possible but after searching the forum I found this helpful article: https://exiftool.org/forum/index.php?topic=9043.0

Which i then added to in order to export as a csv (successfully): exiftool -v -csv > FILEPATH/cropbox.csv -ImageSize -r  FILEPATH | grep CropBox

However the export appears to include a huge amount of additional metadata other than the cropbox dimesnsions (which is great but for this specific task I would like to isolate the exported metadata to just the cropbox).

If anyone can advise on a different command line it would be much appreciated. Thanks very much in advance.

Phil Harvey

You could try this with the attached config file:

exiftool -config cropbox.config -cropbox FILE

But unfortunately this will join all crop boxes into a single tag.  I'll patch ExifTool 12.31 so this will generate separate CropBox tags for each crop box.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jrap1000

Thank you so much Phil, that would be incredible - really really appreciate it.

Excuse my very basic knowledge of this (this is my first real attempt at working with a command line interface), but I have added the cropbox config file to the config file folder then run the script, and it tells me that the config file was not found. I have attached screengrabs detailing what I mean. Is there a specific action I am missing to install (or equivalent) the config file?

Thanks again Phil

Phil Harvey

Instead of typing "cropbox.config" on the command line, try dragging and dropping the file onto the command window.  This will enter the required path name for you.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jrap1000

Brilliant, this worked a treat, thanks again Phil, extremely good of you.

Jon