How to set the trim/art/crop/media box of a PDF with AppleScript?

Hi,

I need to set the trim box of 42 PDF documents and would like to automate this process. But before writing a script from scratch I would like to ask if someone already created such a droplet or can kindly provide some sample code.

I have Acrobat Pro 7-9 available in our department, also the Creative Suite CS2-4. I am open to all solutions (JavaScript, CLI) :smiley:

Thanks so much in advance!

Best regards from (way too) busy Berlin,

Martin

Martin, the boxes are easily set its just the measurement is in points. This would crop off 10mm, bleed 5mm in from that trim 5mm in again.

tell application "Adobe Acrobat 7.0 Professional"
	activate
	tell active doc
		repeat with i from 1 to count of pages
			tell page i
				set {L, T, R, B} to media box
				set crop box to {L + 10 * 2.834645, T - 10 * 2.834645, R - 10 * 2.834645, B + 10 * 2.834645}
				set bleed box to {L + 15 * 2.834645, T - 15 * 2.834645, R - 15 * 2.834645, B + 15 * 2.834645}
				set trim box to {L + 20 * 2.834645, T - 20 * 2.834645, R - 20 * 2.834645, B + 20 * 2.834645}
			end tell
		end repeat
	end tell
end tell

Hi Mark,

Your script works a treat! I have no experience with Acrobat Pro yet, so you really helped me a lot with this.

May you have a wonderful day :wink:

Best regards,

Martin

Mark67,
I am new to applescript as well but am extremely interested in how it works. If you wouldn’t mind, could you explain where you got the 2.834645 that you are using in your script? I would greatly appreciate it. Thanks so much,
Mbarzizza

It’s a points to millimeter conversion value. The .pdf stores points and I like metric. It’s best put in a variable mm then in script editor it almost look right. 20mm