ExifTool Forum

General => Metadata => Topic started by: jrap1000 on August 16, 2021, 06:25:56 PM

Title: Export PDF Crop
Post by: jrap1000 on August 16, 2021, 06:25:56 PM
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.
Title: Re: Export PDF Crop
Post by: Phil Harvey on August 17, 2021, 08:15:39 AM
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
Title: Re: Export PDF Crop
Post by: jrap1000 on August 17, 2021, 07:44:27 PM
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
Title: Re: Export PDF Crop
Post by: Phil Harvey on August 17, 2021, 09:38:33 PM
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
Title: Re: Export PDF Crop
Post by: jrap1000 on August 17, 2021, 10:51:21 PM
Brilliant, this worked a treat, thanks again Phil, extremely good of you.

Jon