Introduction
A .pages file is a document from
Apple Pages, the word processor in Apple’s
iWork suite, first released in 2005. It holds both word processing documents and
page layout documents such as posters and newsletters. Apple has never published the
format, so other programs open it only partly, and most people exchange Pages
documents by exporting them to DOCX or
PDF.
Structure
Since the 2013 versions of iWork, a Pages document is a ZIP archive (or, on older
setups, a macOS package folder) holding an Index folder of
.iwa files, the pictures in Data, a Metadata
folder and preview images. IWA files hold the document as Protocol Buffers messages,
compressed with a variant of Snappy framing. Versions before 2013 stored the
document as XML instead. In the package (folder) form the .iwa files are
kept inside a file Index.zip rather than an Index
folder.
The package and encryption page covers the files of a document and its password encryption; the IWA archives page the chunk framing, Snappy compression and the object stream. The fields of the messages, as recovered from Pages 5.0, are on document messages (the document root, settings, sections, persistence and style sheets), text and styles and drawables, and every type number on message type numbers. Tables, formulas and charts are described field by field; the undo commands are on undo commands (Pages, text and drawing), table undo commands and chart undo commands. Apple has published no specification of the current format. For the earlier XML format, Apple’s 2005 iWork Programming Guide covered Pages 1 and Keynote 2 without the complete schema (Technical Q&A QA1412); no copy of it, and no Apple description of the iWork ’09 XML format, was found. The XML format is not described here.
zipIndex/Document.iwa and other.iwafiles, the document itselfIWAzipData/ pictures and other mediavarieszipMetadata/ document identifiers and propertiesvarieszippreview.jpg and smaller previewsJPEG
Not described
Known, not yet covered
- Viewer: the explorer has no Pages viewer; a
.pagesfile shows as a ZIP archive and its IWA files as raw bytes. The Snappy framing, the archive and message headers and every message are described on the IWA archives and document messages pages, so a viewer can be built.
Unknown
- Reference: every message or field Apple added after Pages 5.0 (2013). The only public definitions are those recovered from that version, and no later ones were found. Viewer: such data would show as an unknown field with its number.
- Reference: how cells are packed in a table tile (the
cellStorageBufferandcellOffsetsbyte buffers), the packed cell and size numbers, and the function table of the formula engine, on the tables and formulas pages. - Reference: the names of enumeration values and integer codes the
recovered definitions leave as numbers, such as the wrap codes and
text_command_flagsof the undo commands. - Reference: the XML formats of Pages 1 to iWork ’09. Apple’s 2005 iWork Programming Guide covers Pages 1 but no copy was found, and no Apple description of the ’09 format exists that was found.
- Reference: the 20 trailing bytes of each encrypted file, which the source calls garbage; see package and encryption.
Links
Software
- Apple Pages – Apple’s word processor, which makes the format (macOS, iOS, web through iCloud)
- LibreOffice Writer – free office suite’s word processor, which imports some Pages documents (Windows, macOS, Linux)
Reference
- iWorkFileFormat – a reverse-engineered description of the IWA format, with the message definitions and type numbers recovered from Pages 5.0
- Technical Q&A QA1412 – Apple’s 2005 note pointing to its iWork Programming Guide for the Pages 1 and Keynote 2 formats