The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Exporting omnigraffle canvases to PDF,SVG,PNG,EPS from command line Thread Tools Search this Thread Display Modes
Hi,

I use OmniGraffle a lot especially when composing LaTeX documents. For that the manual export to PDF or EPS would be to cumbersome. Therefore I created a small utility that does the job automatically using the Applescript interface from OmniGraffle. It allows to export a specific canvas or all of them into various formats. Also it does integrate with rubber - a wrapper for LaTeX document compilation so the whole process can be automated.

It is available at github.com under my username (fikovnik) as omnigraffle-export (I'm sorry I cannot post URLs).

Any feedback will be greatly appreciated!

/cheers
Filip
 
Filip:

I have not used python before, but the script looks clean. I need to specify a resolution for each canvas to support the different screens in iOS. An example of a OmniGraffle Pro document where each canvas is an icon (i.e.: a deck of cards).

Code:
$ omnigraffle-export -f png --resolution 1.0 cards.graffle DeckImages

$ omnigraffle-export -f png --resolution 2.0 --suffix "@2x~iphone" cards.graffle DeckImages
The --resolution is the omnigraffle applescript "export setting - resolution"
The --suffix will be added to the filename.

If the canvas was named ace, then ace.png, and ace@2x~iphone.png would be generated.

When I get to the point of export my cards, I'll make the changes to your script. Unless, of course, you add it first ;)
 
Hi Kent,

Glad you find it useful. Please feel free to clone it on github and add these functionalities.

The --resolution will be very simple to add:

From the ASDictionary for OmniGraffle suites:
  • resolution short_float -- The number of pixels per point in the resulting exported image (1.0 for 72 DPI)
so in the export method you add new parameter and use it like:

Code:
self.og.current_export_settings.resolution.set(resolution)
The --suffix will be probably even easier as you could reuse the namemap argument for the export all. It is a lambda function (like a block in objc) and so you call it:

Code:
schema.export_all(target, fmt=format, force=options.force, namemap=lambda c, f: "%s%s.%s" % (c, suffix, f)))
The c is the canvas name and f is the target format and the suffix is your suffixed obtained from the options.suffix. You need to add both options to the option parser: parser.add_option.

Hope it help,

/cheers
Filip
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Line Build Fails For OmniFileStore at OFSDocumentStore.m davidbitton Omni Frameworks 3 2012-06-13 12:03 AM
Selecting 003 rows with 'command-line' queries RobTrew OmniOutliner 3 for Mac 1 2010-07-08 02:46 AM
Redirecting command line output into OO ptorngaard OmniOutliner 3 for Mac 3 2009-04-06 12:29 AM
OmniGraffle Frustrations - Master Canvases ggaudrea OmniGraffle General 3 2008-05-01 05:02 PM
Create new search through command line m-rick OmniWeb General 1 2007-03-19 04:27 PM


All times are GMT -8. The time now is 11:13 PM.


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