14.2 The page element14 The Ipe file format14.1 The elements of an Ipe XML file

14.1 The elements of an Ipe XML file

A file can optionally start with the <?xml> tag, which is simply ignored by Ipe.

The only element in the file must be <ipe>. The optional attribute version indicates the earliest Ipelib version that can interpret the document. This allows for extensions to the Ipe file format, but not withdrawal of features. Ipe will refuse to load documents that require a version larger than its own. The optional attribute creator indicates the program that created the file.

The <ipe> element contains, in this order, an optional <info> element, an optional <preamble> element, an optional series of <ipestyle> elements, an optional series of <bitmap> elements, and a series of <page> elements.

The <info> element takes the optional attributes title, author, subject, keywords, pagemode, bbox, created, and modified. The only value for pagemode currently understood by Ipe is fullscreen. If the value of bbox is cropbox, Ipe will create a CropBox attribute when saving to PDF. The value of created and modified should be a date in PDF format, that is a string like "D:20030127204100".

The contents of the preamble element is used as the LaTeX preamble when running LaTeX to process the text objects in the document. It should not contain a \documentclass command, but can contain \usepackage commands and macro definitions.

The contents of the <ipestyle> element is parsed as an Ipe style sheet, see below. Several style sheets form a stack or "cascade", with the last <ipestyle> element becoming the top-level style sheet. When symbolic names are looked up, the style sheets are checked from top to bottom. Ipe always appends the built-in standard stylesheet at the bottom of the stack.

Each <bitmap> element defines a bitmap to be used by <image> objects. It takes the required attributes id (the value must be an integer that will define the bitmap throughout the Ipe document), width and height (integers, specifying the dimensions of the bitmap in pixels), ColorSpace (possible values are "DeviceGray", "DeviceRGB", and "DeviceCMYK"), BitsPerComponent (only 8 is currently allowed!), and length (indicating the number of bytes of image data). The optional attribute Filter can take one of the values "FlateDecode" or "DCTDecode" to indicate a compressed image (the latter is used for JPEG images). The length attribute can be omitted if there is no filter (Ipe can then deduce it from the other attributes).

The contents of the <bitmap> element is the image data in hexadecimal format. White space between bytes is ignored. If no filter is specified, pixels are stored row by row, with rows padded to a full byte boundary.

Note that images with color maps are not supported, and such support is not planned. (The Insert image ipelet does allow you to insert images with color maps, but they are stored as 24-bit images. Since the data is compressed, this does not seriously increase the image data size.)


14.2 The page element14 The Ipe file format14.1 The elements of an Ipe XML file