Posting this as others may find it useful.
I've created this due to issues with image performance (even with DPI is boosted significantly) and wanting a clean way to export each canvas so I can link the individual items (PDFs in this case) in InDesign.
This script will
- Save PDFs in the same directory as the current Omnigraffle file
- Only work if one Omnigraffle document is open
- Overwrite when you re-run it
- Use canvas names for PDF naming
Code:
tell application "OmniGraffle Professional 5"
activate
set theDocument to front document
set theCanvases to every canvas of theDocument
set fileName to (name of theDocument)
set filePath to (path of theDocument)
set adjustment to (length of filePath) - ((length of fileName) + 8)
set fileDirectory to texts 1 thru adjustment of filePath
set canvasCount to count of canvases of theDocument
set area type of current export settings to current canvas
repeat with canvasNumber from 1 to canvasCount
set cName to name of canvas canvasNumber of theDocument
set cName to cName's words as string
set canvas of front window to canvas canvasNumber of theDocument
set saveLocation to (fileDirectory & cName & ".pdf")
log saveLocation
save theDocument in (saveLocation)
end repeat
end tell