Scripting Indesign "Import Options" when placing a PDF

I am trying to modify a script so that it allows me to specify which type of “box” is used by Indesign to place a PDF file into an InDesign document. The default is “bounding box” but I am trying to figure out how to get the script to place the PDF using “media box” instead. The options are available in the “place” command of the UI if you choose “show import options” when selecting a PDF file, but I’ve not seen any reference to them within the InDesign library or reference guide.

place placePath on rectangle "placeFrame" of page 1

I’m hoping there’s something along the lines of

place placePath on rectangle "placeFrame" of page 1 with properties {crop to:media box}

that would work. I think I saw a reference that would have the “import options” dialog pop up, but I need this script to be automated and not have a dialog pop up to choose media box.

Hi

try modifying the prefs as per below

tell application "Adobe InDesign CS3"
	set PDF crop of PDF place preferences to crop media
end tell

Budgie

Fantastic! Exactly what I was looking for!

I was thinking it was something that needed to be set during the place command, but this is even better since my script allows for any type of file to be placed, and this preset setting would determine how all PDFs get placed, while not getting in the way of other file types.

This also allows me to not worry about messing with the user’s existing settings for this, since this is a setting that seems to “stick”:


tell application "Adobe InDesign CS3"
	set userCrop to PDF crop of PDF place preferences -- get the user's current settings for safekeeping
	set PDF crop of PDF place preferences to crop media  -- content, art, PDF, trim, bleed, media

	-- Do the actual placing

	set PDF crop of PDF place preferences to userCrop -- set the user's orignal setting back
end tell

Thanks!