looking for some help to run a script on a 600+ page PDF document that includes different page sizes. I’d like to be able have the script create a text file with the pages listed out and their appropriate crop box notated.
ie.
1 - 8.5 x 11
2 - 8.5 x 11
3 - 11 x 17
4 - 8.5 x 11
5 - 11 x 17
If you have a copy a Acrobat Pro then the below script should do what you want.
property pointsToInches : 0.0138888889
property pointsToMM : 0.352777778
set ptd to POSIX path of (path to desktop as string)
tell application "Adobe Acrobat Pro"
tell active doc
set docName to name
do shell script "echo " & quoted form of ("PageNo" & tab & "Width" & tab & "height") & " > " & quoted form of (ptd & docName & "-page_sizes.txt")
repeat with i from 1 to count of pages
tell page i
set cropBox to crop box
set trimBox to trim box
end tell
my writeToFile(ptd, docName, i, cropBox, trimBox)
end repeat
end tell
end tell
do shell script "open " & quoted form of (ptd & docName & "-page_sizes.txt")
on writeToFile(ptd, docName, i, cropBox, trimBox)
--set docHeight to round (((item 2 of trimBox) - (item 1 of trimBox)) * pointsToInches) rounding as taught in school --> use this line if you want the trim box size
--set docWidth to round (((item 3 of trimBox) - (item 4 of trimBox)) * pointsToInches) rounding as taught in school --> use this line if you want the trim box size
set docHeight to round (((item 2 of cropBox) - (item 1 of cropBox)) * pointsToInches) rounding as taught in school
set docWidth to round (((item 3 of cropBox) - (item 4 of cropBox)) * pointsToInches) rounding as taught in school
do shell script "echo " & quoted form of ((i as string) & tab & docWidth & tab & docHeight) & " >> " & quoted form of (ptd & docName & "-page_sizes.txt")
end writeToFile