The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Canvas to PDF Applescript (http://forums.omnigroup.com/showthread.php?t=24079)

simonpssetterstrom 2012-05-01 01:30 PM

Canvas to PDF Applescript
 
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[LIST=1][*]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[/LIST]
[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[/CODE]


All times are GMT -8. The time now is 03:27 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.