Document Export

OmniGraffle supports the export of canvases to documents of various formats, such as to image, stencil, or template formats. In this section, we’ll examine how export using the built-in Omni Automaton commands.

This section examines how to create File Wrappers in preparation for the export of documents and content.

Documentation regarding the other classes involved in the saving and export of OmniPlan documents can be found in FileTypes and FileSavers.

FileWrappers

If you think of an outline as a set of data, then it’s easy to understand that an outline’s data can be packaged in a variety of ways. Each “data package” has a set of parameters that determine how the outline data is stored or presented.

For example, one package may store the data as tabbed data, while another may store the outline data in XML format. Each of the supported file packaging formats has its own set of parameters. In terms of Omni Automation, these file packages are referred to as FileWrappers.

Each FileWrapper has a unique type identifier that identifies that wrapper. To get a list of the export file types supported by OmniOutliner, write a simple script to access the value of the writableTypes property of the Document class. The result will be an array of the identifiers for the FileWrappers supported in OmniGraffle.

NOTE: a complete list of all readable and writeable filetypes supported by OmniGraffle is available here.

document.writableTypes.join("\n")

A writable type is used when creating a new file wrapper instance:

wrapper = document.fileWrapper('com.Adobe.pdf')

Instance Properties

Each FileWrapper instance has a set of supported properties, most of which have values that are read-only, with the exception of the preferredFilename property whose value can be set in a script.

wrapper = document.fileWrapper('public.png') wrapper.preferredFilename = "My Canvas Image.png"

The value of the contents property is a representation of the outline data, which can be manipulated using class and instance functions from the Data class:

wrapper = document.fileWrapper('public.png') wrapper.preferredFilename = "My Canvas Image.png" encodedData = wrapper.contents.toBase64()

And here’s an example of exporting the current canvas to a new OmniFocus task as a PNG image:

taskName = encodeURIComponent(document.name) cnvsName = document.windows[0].selection.canvas.name attachmentName = encodeURIComponent(cnvsName + '.png') wrapper = document.fileWrapper('public.png') encodedData = wrapper.contents.toBase64() urlStr = "omnifocus://localhost/add?name=" + taskName + "&attachment=" + encodedData + "&attachment-name=" + attachmentName URL.fromString(urlStr).call(function(result){})
omnigraffle://localhost/omnijs-run?script=taskName%20%3D%20encodeURIComponent%28document%2Ename%29%0AcnvsName%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%2Ename%0AattachmentName%20%3D%20encodeURIComponent%28cnvsName%20%2B%20%27%2Epng%27%29%0Awrapper%20%3D%20document%2EfileWrapper%28%27public%2Epng%27%29%0AencodedData%20%3D%20wrapper%2Econtents%2EtoBase64%28%29%0AurlStr%20%3D%20%22omnifocus%3A%2F%2Flocalhost%2Fadd%3Fname%3D%22%20%2B%20taskName%20%2B%20%22%26attachment%3D%22%20%2B%20encodedData%20%2B%20%22%26attachment-name%3D%22%20%2B%20attachmentName%0AURL%2EfromString%28urlStr%29%2Ecall%28function%28result%29%7B%7D%29

View this page for more detail about the previous example.

Class Functions

The class functions for the FileWrapper class:

Instance Functions

The instance functions for the FileWrapper class:

FileWrapper.Type

The class properties of a FileWrapper.Type:

As mentioned previously, here is a full explanation of the FileWrapper.Types supported by OmniGraffle:

One of the main reasons you use a design app like OmniGraffle is so you can export your work as image or graphics files for use with other projects. OmniGraffle exports files to the standard image types, such as PNG, JPEG, and TIFF, as well as to PDF and EPS. And if you have OmniGraffle Pro, you can export files to Microsoft Visio and as SVG (Scalable Vector Graphics).

Here are the various export formats with their corresponding FileWrapper.Type:

PNG (Portable Network Graphics)
Portable Network Graphics is a raster graphics file format that supports lossless data compression. PNG was created as an improved, non-patented replacement for Graphics Interchange Format (GIF), and is the most widely used lossless image compression format on the Internet. Wikipedia
public.png
JPEG (Joint Photographic Experts Group)
JPEG is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. JPEG typically achieves 10:1 compression with little perceptible loss in image quality. Wikipedia
public.jpeg
GIF (Graphics Interchange Format)
The Graphics Interchange Format (better known by its acronym GIF /dʒɪf/ JIF or /ɡɪf/ GHIF) is a bitmap image format that was developed by a team at the bulletin board service (BBS) provider CompuServe led by American computer scientist Steve Wilhite on June 15, 1987.[1] It has since come into widespread usage on the World Wide Web due to its wide support and portability. Wikipedia
com.compuserve.gif
BMP (Bitmap Image File)
The BMP file format, also known as bitmap image file or device independent bitmap (DIB) file format or simply a bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapter), especially on Microsoft Windows and OS/2 operating systems. Wikipedia
com.microsoft.bmp
TIFF (Tagged Image File Format)
Tagged Image File Format, abbreviated TIFF or TIF, is a computer file format for storing raster graphics images, popular among graphic artists, the publishing industry,[1] and photographers. TIFF is widely supported by scanning, faxing, word processing, optical character recognition, image manipulation, desktop publishing, and page-layout applications.[2] The format was created by Aldus Corporation for use in desktop publishing. Wikipedia
public.tiff
Adobe Photoshop (Image File)
Photoshop files have default file extension as .PSD, which stands for "Photoshop Document." A PSD file stores an image with support for most imaging options available in Photoshop. These include layers with masks, transparency, text, alpha channels and spot colors, clipping paths, and duotone settings. Wikipedia
com.adobe.photoshop-image
OmniOutliner Document (.oo3)
Exports a .ooutline file, containing the textual data from the OmniGraffle canvas. Exporting to OmniOutliner works best for diagrams that adhere to a tree-like structure. OmniGraffle uses the connection lines between shapes to create the outline hierarchy.
com.omnigroup.omnioutliner.oo3
OmniGraffle Document (.graffle)
Export a standard OmniGraffle document in either flat file or package format.
com.omnigroup.omnigraffle.graffle
com.omnigroup.omnigraffle.graffle-package
com.omnigroup.omnigraffle.diagramstyle
com.omnigroup.omnigraffle.diagramstyle-package
OmniGraffle Stencil (.gstencil)
Export a standard OmniGraffle stencil file in either flat file or package format
com.omnigroup.omnigraffle.gstencil
com.omnigroup.omnigraffle.gstencil-package
OmniGraffle Template (.gtemplate)
Export a standard OmniGraffle template file in either flat file or package format
com.omnigroup.omnigraffle.template
com.omnigroup.omnigraffle.template-package
PDF (Portable Document Format)
The Portable Document Format (PDF) is a file format developed in the 1990s to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. Based on the PostScript language, each PDF file encapsulates a complete description of a fixed-layout flat document, including the text, fonts, vector graphics, raster images and other information needed to display it. PDF was standardized as an open format, ISO 32000, in 2008, and does not require any royalties for its implementation. Wikipedia
com.adobe.pdf
EPS (Encapsulated PostScript)
Encapsulated PostScript (EPS) is a DSC-conforming PostScript document with additional restrictions which is intended to be usable as a graphics file format. In other words, EPS files are more-or-less self-contained, reasonably predictable PostScript documents that describe an image or drawing and can be placed within another PostScript document. Simply, an EPS file is a PostScript program, saved as a single file that includes a low-resolution preview "encapsulated" inside of it, allowing some programs to display a preview on the screen. Wikipedia
com.adobe.encapsulated-postscript
SVG (Scalable Vector Graphics)
Scalable Vector Graphics (SVG) is an XML-based vector image format for two-dimensional graphics with support for interactivity and animation. The SVG specification is an open standard developed by the World Wide Web Consortium (W3C) since 1999. Wikipedia
public.svg-image
Microsoft Visio
Microsoft Visio (formerly Microsoft Office Visio) is a diagramming and vector graphics application and is part of the Microsoft Office family. The product was first introduced in 1992, made by the Shapeware Corporation. It was acquired by Microsoft in 2000.
com.omnigroup.foreign-types.ms-visio.xml
HTML Image Map
HTML Image Maps have been around for a long time, and continue to be a useful interface element on the web. HTML image maps typically appear as single, cohesive image on a website that, when moused over, present users with the option to click an area and then go to another part of the website.
com.omnigroup.omnigraffle.HTMLExport
taskName = encodeURIComponent(document.name) cnvsName = document.windows[0].selection.canvas.name attachmentName = encodeURIComponent(cnvsName + '.png') wrapper = document.fileWrapper('public.png') encodedData = wrapper.contents.toBase64() urlStr = 'workflow://run-workflow?name=Add%20to%20Photos&input=text&text=' + encodedData URL.fromString(urlStr).call(function(result){})
omnigraffle://localhost/omnijs-run?script=taskName%20%3D%20encodeURIComponent%28document%2Ename%29%0AcnvsName%20%3D%20document%2Ewindows%5B0%5D%2Eselection%2Ecanvas%2Ename%0AattachmentName%20%3D%20encodeURIComponent%28cnvsName%20%2B%20%27%2Epng%27%29%0Awrapper%20%3D%20document%2EfileWrapper%28%27public%2Epng%27%29%0AencodedData%20%3D%20wrapper%2Econtents%2EtoBase64%28%29%0AurlStr%20%3D%20%27workflow%3A%2F%2Frun-workflow%3Fname%3DAdd%2520to%2520Photos%26input%3Dtext%26text%3D%27%20%2B%20encodedData%0AURL%2EfromString%28urlStr%29%2Ecall%28function%28result%29%7B%7D%29
UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER