Question

I have an AppleScript that exports the active document in InDesign to a PDF on my desktop.

--this script exports all opened InDesign document as PDFs

set my_destination to (path to desktop) as string

tell application id "com.adobe.InDesign"
activate
--next line collects all current PDF export presets
set my_pdf_export to get the name of every PDF export preset
--next line makes you choose which preset to use for ALL opened InDesign documents
set my_pdf_choice to (choose from list my_pdf_export) as string
--loop starts here
repeat with this_doc in (active document)
    --next line gets the name of the active InDesign document
    set doc_name to get name of this_doc
    --next 3 lines perform the actual PDF export
    tell this_doc
        export format PDF type to my_destination & (characters 1 thru -6 of doc_name) & ".pdf" using my_pdf_choice without showing options
    end tell
end repeat
end tell

The script prompts for a PDF preset selection before exporting.

I'd like the script to export only the active page of the active document.

I've tried a couple things like replacing "active document" with active page", however I am not too knowledgable about AppleScript.

Any ideas?

Was it helpful?

Solution

It looks like you got your code from This Macscripter question, and the code is already in that script. You just need to set the page range of InDesign's PDF Export Preferences

tell PDF export preferences
    set page range to "1, 3-5"
end tell

Just make sure to set it back at the end, because this is a persistent application setting.

tell PDF export preferences
    set page range to all pages
end tell
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top