Skip to main content
Participant
April 8, 2019
Question

getting trim box via AppleScript

  • April 8, 2019
  • 1 reply
  • 1173 views

          I need to determine if a PDF file has a trim box and a bleed box using AppleScript. The following code returns dimensions for a trim box and bleed box, even if the PDF it's run on doesn't contain said boxes. Presumably Acrobat is getting that information from the media box or the crop box. Is there a way for have it tell me if a trim box and bleed box actually exist in the PDF?

tell application id "com.adobe.Acrobat.Pro"

  try

  set trimSize to get trim box of page 1 of active doc

  set bleedSize to get bleed box of page 1 of active doc

  end try

end tell

-->bleedSize {0.0, 792.0, 612.0, 0} trimSize {0.0, 792.0, 612.0, 0.0} Result on a US letter-sized PDF that contains no bleed box or trim box.

This topic has been closed for replies.

1 reply

Legend
April 8, 2019

I doubt it.

By definition, the trim box is the same as the crop box if there is no TrimBox.

The crop box is the same as the media box if there is no MediaBox.

The bleed box is the same as the trim box if there is no BleedBox.

If you want to preflight for the presence of the key, you are probably checking for PDF/X and can use Preflight in Acrobat Pro.

Participant
April 10, 2019

I have a script that imposes PDFs in InDesign. If the pdf contains no trim box (or bleed box if it has bleed), the script stops when it is ready to place pdf pages in InDesign. The first thing the script does is have Acrobat open the pdf to get the page size, so that is the perfect opportunity to check for the presence of the required page box(s). I suppose I can use "try" when InDesign begins placing pages and assume there is no page box if the try produces an error. However that happens well into the script and I really wanted to determine if the page boxes were present before that point. Maybe I can come up with another approach.

Thanks for the input! I had kind of assumed that was what Acrobat was doing but was hoping there was a way around it.