# The Plucker Document Format

## Introduction

This document is the official description of the Plucker format.

## Overview

The Plucker document format supports a multi-page (in the Web sense of 'page') hyperlinked information structure containing both 'rich' text and images. Links may be internal to the document or link to other documents. External links, in standard URL form, may be included and displayed, but not followed. Images may either be embedded in a text page, as with HTML, or be included as separate stand-alone pages.

Plucker documents are structured so that they can be used both with a file-system-oriented operating system such as Unix or Windows, and with the PalmOS, a non-file-system-oriented OS. To this end, they always begin with a standard PalmOS record database prefix, which consists of four parts: the database header, a record-id list, an AppInfo block, and a SortInfo block. The Plucker format does not use the SortInfo block, which is therefore null, and consequently occupies no space in the document prefix.

The record database prefix is then followed by a sequence of application-specific records. In a Plucker document, this sequence consists of one index record, followed by a series of data records. The index record contains information about the data records, along with some global information, such as the type of compression used. Each data record contains either a page, an image, or data about the document, such as bookmarks or URL data.

The format is big-endian; any multi-byte numeric values specified in this document are big-endian. Images are stored in the Palm image format; for more information on this format please consult http://www.palmos.com/dev/tech/docs/.

## The Database Prefix

### The Database Header

The database header is a fixed-size structure of 72 bytes. It contains the name of the database, the Plucker version number, various timestamps (creation, modification, last backup), and several flags. All timestamps are given using the PalmOS standard, seconds since 12:00 AM on January 1, 1904.

Field | Bytes | Type | Notes
docName | 32 | String | Must contain a NUL-terminated 7-bit ASCII string (only character codes 0x20-0x7E are valid) giving the name of the document. Because of the terminating NUL character at end, only 31 bytes can actually be used for the name of the document. The first 26 bytes of this string are used by Plucker as a unique ID for the document; names should be unique in the first 26 characters.
flags | 2 | Bitfield | Most bits in this field are unused. Unused bits should be set to zero on document creation, but reader software should not expect them to stay at this value. Valid bits are as follows. All numeric values given are big-endian.
Name | Value | Meaning
CopyPrevention | 0x0040 | Indicates that system should not allow copying of this document.
Launchable | 0x0200 | Indicates that this document should be presented as a first-class object on desktop renderings. If this bit is set, an AppInfo block must be included.
Backup | 0x0008 | Indicates that this document should be backed up, if the system includes such a capability.
version | 2 | Numeric | Version of the Plucker format used in this document. Must have the value 1.
creationDate | 4 | Timestamp | Time of document creation
modificationDate | 4 | Timestamp | Time document last modified
unused1 | 8 | Numeric | Must be zero at document creation, but any specific value should not be relied upon.
appInfoOffset | 4 | Numeric | Either zero, if no appInfo is present, or the offset from the beginning of the document to the start of the appInfo block.
sortInfoId | 4 | Numeric | Must be zero.
magic | 8 | String | Must be the 8 ISO Latin-1 characters "DataPlkr". No terminating NUL character.
unused2 | 4 | Numeric | Must be zero at document creation, but any specific value should not be relied upon.

### The Record-ID List

This list consists of a six-byte list header, followed by one ID entry for each data record in the document. The list header has the structure:

Field | Bytes | Type | Notes
nextRecordListID | 4 | Numeric | Must be zero.
numRecords | 2 | Numeric | Number of records in the document, including the index record.

This is then followed by numRecords entries of the following structure:

Field | Bytes | Type | Notes
recordOffset | 4 | Numeric | Number of bytes from the start of the document to the beginning of the record
attributes | 1 | Bitfield | Record attributes -- should be zero.
uniqueID | 3 | Numeric | A local (document-specific) unique ID for the record. This is not used by Plucker (because it is not preserved by PalmOS through beaming of a document), but must still be different for each record.

Finally, there are two bytes of zero-padding to bring the structure alignment back to 4 bytes.

### The AppInfo Block

Typically, this is only present when the launchable flag is set in the flags field of the database header. No Plucker data aside from icon display information and a versioning string is stored in this block. This block has the following structure:

Field | Bytes | Type | Notes
signature | 4 | Numeric | Must contain the value 0x6C6E6368.
hdrVersion | 2 | Numeric | Must have the value 3.
hdrEncoding | 2 | Numeric | Must have the value 0.
verStrWords | 2 | Numeric | The number of two-byte words following, containing the version string.
verStr | 2 * verStrWords | String | NUL-terminated ISO Latin-1 string, padded at end if necessary with a zero byte to an even-byte boundary, containing a version string to display to the user containing version information for the document.
pqaTitleWords | 2 | Numeric | The number of two-byte words in the following pqaTitleStr.
pqaTitleStr | 2 * pqaTitleWords | String | NUL-terminated ISO Latin-1 string, padded at end if necessary with a zero byte to an even-byte boundary, containing a title string for iconic display of the document.
iconWords | 2 | Numeric | Number of two-byte words in the following icon image.
icon | 2 * iconWords | Image | Image (32x32) in Palm image format to be used as an icon to represent the document on a desktop-style display. The image may not use a custom color map.
smIconWords | 2 | Numeric | Number of two-byte words in the following icon image.
smIcon | 2 * smIconWords | Image | Small image (15x9) in Palm image format to be used as an icon to represent the document on a desktop-style display. The image may not use a custom color map.

## The Index Record

This record includes info about the compression type used for the Plucker document and also what IDs the reserved records use. The viewer will use this record to know where to look for the reserved records and whether it must have support for ZLib compression. This record should always be the first record in the Plucker document (i.e. at index 0).

Field | Bytes | Type | Notes
uid | 2 | Numeric | unique ID for record, always 0x0001
version | 2 | Numeric | 0x0002 if data is ZLib compressed, 0x0001 if DOC compressed
records | 2 | Numeric | number of reserved records
reserved | 4*records | Numeric | reserved ID array

The reserved ID array consists of a series of name/ID pairs, where the ID is the unique ID (2 bytes) for the record and the name is a value (2 bytes) from the following list.

- home.html = 0
- external bookmarks = 1
- URL handling = 2
- default category = 3
- additional metadata = 4
- page list metadata = 5
- sorted URL name data = 6
- external anchor name data = 7

## The Data Records

There are several different types of data records.

- text data (compressed/uncompressed)
- image data (compressed/uncompressed)
- mailto data
- URL handling data
- URL data (compressed/uncompressed)
- external bookmarks
- default category
- metadata
- style sheets (not yet implemented)
- font pages (not yet implemented)
- table data (compressed/uncompressed)
- page list metadata
- sorted URL handling data
- sorted URL data (compressed/uncompressed)
- external anchor name handling data
- external anchor name data (compressed/uncompressed)

Each data record starts with a header, having the following structure:

Field | Bytes | Type | Notes
uid | 2 | Numeric | Unique ID for record. IDs must be sorted in increasing order. Currently the ID is not allowed to be 0xFFFF. Moreover, some earlier versions of the viewer had a bug that crashed on records numbered 0x8000-0xFFFE.
paragraphs | 2 | Numeric | number of paragraphs
size | 2 | Numeric | total length of data before compression
type | 1 | Numeric | Data type. Must be one of the following:
Data type | Value
DATATYPE_PHTML | 0
DATATYPE_PHTML_COMPRESSED | 1
DATATYPE_TBMP | 2
DATATYPE_TBMP_COMPRESSED | 3
DATATYPE_MAILTO | 4
DATATYPE_LINK_INDEX | 5
DATATYPE_LINKS | 6
DATATYPE_LINKS_COMPRESSED | 7
DATATYPE_BOOKMARKS | 8
DATATYPE_CATEGORY | 9
DATATYPE_METADATA | 10
DATATYPE_STYLE_SHEET | 11
DATATYPE_FONT_PAGE | 12
DATATYPE_TABLE | 13
DATATYPE_TABLE_COMPRESSED | 14
DATATYPE_COMPOSITE_IMAGE | 15
DATATYPE_PAGELIST_METADATA | 16
DATATYPE_SORTED_URL_INDEX | 17
DATATYPE_SORTED_URL | 18
DATATYPE_SORTED_URL_COMPRESSED | 19
DATATYPE_EXT_ANCHOR_INDEX | 20
DATATYPE_EXT_ANCHOR | 21
DATATYPE_EXT_ANCHOR_COMPRESSED | 22
flags | 1 | Bitfield | Bit-mapped record flags. Valid bits are as follows (all numeric values given are big-endian); unused bits should be set to zero.
Name | Value | Meaning
Continued Record | 0x01 | A value of one indicates that the record is continued by the fragment in the next sequential record of the same type. This value is applicable to the following data types: DATATYPE_PHTML DATATYPE_PHTML_COMPRESSED A value of zero indicates that the record is not to be continued (i.e. there are no fragments beyond this one, or this is the last one).
Navigation Metadata | 0x02 | A value of one indicates that the text or image data in this record is followed by additional navigation metadata.

### Compression and the Owner-ID

This data format supports two forms of compression, DOC and ZLIB. That part of a data record that occurs after the header is compressed as a single chunk. All compressed records in a single document must use the same compression format. Compressed records may be mixed with uncompressed records. In a compressed record, the length of the compressed data must be less than its uncompressed length.

DOC compression is the the format invented for early Palm usage.

ZLIB compression uses the ZLib format documented in Internet RFCs 1950 and 1951. See also http://www.gzip.org/zlib/manual.html for a description of the library used to perform the compression and decompression.

Plucker documents may be keyed to a specific string of 40 or fewer ASCII characters, called the owner-id. When such a key is specified, zlib compression must be used in the document. When an owner-id is specified, the beginning of each zlib-compressed data segment is XOR'ed with a value derived from the key, after compression, and must be XOR'ed again with the derived value before being decompressed. If an owner-id is specified for a document, the metadata record must exist, and must contain an `OwnerID` subrecord giving the CRC-32 of the owner-id string.

The derived value mentioned above is a 40-byte value constructed by forming 10 strings by concatenating the owner-id string with itself 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11 times, then taking the CRC-32 values of each of these concatenations, then packing those 32-bit values in big-endian order into a 40-byte buffer.

### Text data records

For text data the data record header is followed by a series of paragraph headers, each representing a paragraph block in the text data. This series of paragraph headers is then followed by the compressed or uncompressed text data. Each paragraph header has the form:

Field | Bytes | Type | Notes
size | 2 | Numeric | Total length of paragraph before compression. NOTE: No text data should be larger than 32k. If the original document is larger than 32k, then the parser must split it into several records.
attributes | 2 | Bitfield | Paragraph info. The high-order 13 bits are reserved for future use and should be set to zero; the 3 low-order bits contain a numeric value in the range [0..7] giving the amount of extra paragraph spacing (2*value pixels).

The (uncompressed) text data contains a character stream of ISO Latin-1 characters, interspersed with 'functions'.

A function is introduced in the text stream by a NULL character (0x00), followed by a one-byte function code and up to 7 bytes of data. The 3 LSB of the function code represent the remaining function data length; the 5 MSB denote the actual function code. The following functions are valid:

Function Code | Description | Bytes | Arguments
0x0A | Page link begins | 2 | record ID
0x0B | Targeted page link begins | 3 | record ID, target
0x0C | Paragraph link begins | 4 | record ID, paragraph number
0x0D | Targeted paragraph link begins | 5 | record ID, paragraph number, target
0x08 | Link ends | 0 | no data
0x11 | Set font | 1 | font specifier
0x1A | Embedded image | 2 | image record ID
0x22 | Set margin | 2 | left margin, right margin
0x29 | Alignment of text | 1 | alignment
0x33 | Horizontal rule | 3 | 8-bit height, 8-bit width (pixels), 8-bit width (%, 1-100)
0x38 | New line | 0 | no data
0x40 | Italic text begins | 0 | no data
0x48 | Italic text ends | 0 | no data
0x53 | Set text color | 3 | 8-bit red, 8-bit green, 8-bit blue
0x5C | Multiple embedded image | 4 | alternate image record ID, image record ID
0x60 | Underline text begins | 0 | no data
0x68 | Underline text ends | 0 | no data
0x70 | Strike-through text begins | 0 | no data
0x78 | Strike-through text ends | 0 | no data
0x83 | 16-bit Unicode character | 3 | alternate text length, 16-bit unicode character
0x85 | 32-bit Unicode character | 5 | alternate text length, 32-bit unicode character
0x8E | Begin custom font span | 6 | font page record ID, X page position, Y page position
0x8C | Adjust custom font glyph position | 4 | X page position, Y page position
0x8A | Change font page | 2 | font record ID
0x88 | End custom font span | 0 | no data
0x90 | Begin new table row | 0 | no data
0x92 | Insert table (or table link) | 2 | table record ID
0x97 | Table cell data | 7 | 8-bit alignment, 16-bit image record ID, 8-bit columns, 8-bit rows, 16-bit text length
0x9A | Exact link modifier | 2 | Paragraph Offset (The Exact Link Modifier modifies a Paragraph Link or Targeted Paragraph Link function to specify an exact byte offset within the paragraph. This function must be followed immediately by the function it modifies).

The function arguments have the following definitions:

Argument | Bytes | Notes
record ID | 2 | This is either a reference to a record in Plucker document (that is, a real record ID), or an index into the list of URLs, for URLs which have not been included in the document.
image record ID | 2 | reference to image in Plucker document
paragraph number | 2 | paragraph number (starting from 0) to jump to or an index into the external anchor name data if the record ID is pseudo-Record ID for a URL which has not been included in the document.
font specifier | 1 | The font concept used in Plucker is that of a 'standard' font, along with bold and italic versions of that font. There is no font notion corresponding to HTML's <BIG> or <SMALL>. In this markup, boldness and size are specified with a font specifier; italic is specified with a separate function code. There are currently 11 font specification values, with the following meanings (the actual PalmOS fonts used by the Palm viewer are also given):
Value | Description | PalmOS 2.x | PalmOS 3.x
0 | Regular text. | stdFont | stdFont
1 | Suitable for <H1> HTML tags. | boldFont | largeBoldFont
2 | Suitable for <H2> HTML tags. | boldFont | largeBoldFont
3 | Suitable for <H3> HTML tags. | boldFont | largeFont
4 | Suitable for <H4> HTML tags. | boldFont | largeFont
5 | Suitable for <H5> HTML tags. | stdFont | boldFont
6 | Suitable for <H6> HTML tags. | stdFont | boldFont
7 | Regular text, but bold. | stdFont | boldFont
8 | Fixed-width text, suitable for <TT> HTML tags. | stdFont | fixedWidthFont
9 | Small normal text, suitable for <SMALL> HTML tags. | stdFont | stdFont
10 | Small subscript text, suitable for <SUB> HTML tags. | stdFont | stdFont
11 | Small superscript text, suitable for <SUP> HTML tags. | stdFont | stdFont
left margin | 1 | left margin in pixels
right margin | 1 | right margin in pixels
alignment | 1 | alignment code (left = 0, right = 1, center = 2, justify = 3)
height | 1 | height of horizontal rule in pixels, if not given a default value of 2 pixels will be used
width (pixels) | 1 | width in pixels, should be 0 if percentage value should be used
width (%) | 1 | width as the percentage between the current left and right margins. The default is 100%
alternate text length | 1 | When a Unicode character not representable in ISO-Latin-1 is encountered in an HTML document, a Unicode-character function code is inserted, with the 16-bit or 32-bit value of the character. This is followed by a "alternate representation" of the character in ISO-Latin-1 text. This parameter gives the length, in bytes, of the alternate text span. If the viewer can present the Unicode character directly, display of the alternate text should be suppressed.
16 or 32 bit Unicode character | 2, 4 | When a Unicode character not representable in ISO-Latin-1 is encountered in an HTML document, a Unicode-character function code is inserted, with the 16-bit or 32-bit Unicode character code for the character, which this parameter supplies. This is followed by a "alternate representation" of the character in ISO-Latin-1 text. If the viewer can present the Unicode character directly, display of the alternate text should be suppressed.
target | 1 | The target parameter of a link function allows an alternate default target view for a link to be specified. By default, a link will always open in the same view as the current content location. Valid link targets are as follows:
Value | Description
0 | Default View. If specified, the link will be opened in the default view as determined by the reader. This value causes a Targeted Paragraph or Page Link to behave identical to a standard Paragraph or Page Link.
1 | Primary View. Specifies that the link will be opened in the primary window regardless of current content location.
2 | Secondary View/Popup View. Specifies that the link will be opened in the secondary or popup view regardless of current content location.
Paragraph Offset | 2 | specifies an exact byte offset within a paragraph relative to the beginning of the paragraph.

### Image data records

The image data consists of an image in Palm image format, compressed or uncompressed as specified in the document's index record. The image may in addition be internally compressed, via any of the compression techniques allowed in the Palm image format. The fundamental size of an image must be less than 480,000; this size is calculated by multiplying the width (in pixels) by the height (in pixels) by the depth (in bits).

If the fundamental size is greater than 480,000, most parsers can be told to create a Multi-image group. This is a group of image records consisting of parts of the image which the viewer displays as one image. The parts are standard Image data records and the Multi-image record tells how many columns and rows the image has, and the record numbers of the parts.

Field | Bytes | Type | Notes
columns | 2 | Numeric | number of columns in this image
rows | 2 | Numeric | number of rows in this image
image record IDs | 2 * columns * rows | Numeric | References to images in Plucker document. There are (columns * rows) images listed here

### Navigation metadata

This data is optionally appended to the end of a text or image data record based on the setting of the Navigation Metadata flag in the record header. If the Navigation Metadata flag is set to one, the image or text data is immediately followed by the following data structures.

NOTE: If navigation data is appended to a record then the last two bytes in the record shall contain the byte offset from the beginning of the record to the start of the navigation data.

Field | Bytes | Type | Notes
anchor name offset | 2 | Numeric | Byte offset from the beginning of the metadata to the anchor name table for this record or 0xffff if there is no anchor name data.
pagelist offset | 2 | Numeric | Byte offset from the beginning of the metadata to the page list table for this record or 0xffff if there is no page list data.
hierarchy offset | 2 | Numeric | Byte offset from the beginning of the metadata to the hierarchy table for this record or 0xffff if there is no hierarchy data.
topic offset | 2 | Numeric | Byte offset from the beginning of the metadata to the list of topics associates with this record or 0xffff if there is no topic data .
Title Strings | 2+ | String sequence | A series of concatenated NUL-terminated strings in the following order: Long Record Title - The title of the record. This title should allow the record to be identified out of context. Short Record Title - A title string which allows the record to be identified in context. If a given string in the list is not defined, an empty string (NUL) must still be entered in the appropriate location in the string sequence.

The offsets block and title strings are followed by a series of tables.

The anchor name table specifies the offset of the anchor names within the text record.

Field | Bytes | Type | Notes
anchor names | 2 | Numeric | number of anchor names
anchor name data | 2*anchor names | Numeric Array | This field is an array of 2 byte offsets, each representing the corresponding offset associated with an anchor name relative to the beginning of the text record. The order of each offset corresponds to the order of the string for that anchor name within the anchor name string sequence below.
anchor name strings | variable size | String sequence | A concatenated sequence of NUL-terminated strings, each an anchor name name. The relative location of an anchor name string in the string sequence represents its index into the anchor name data.

The page list table contains the uid of the previous and next records relative to this record for one or more page lists. Each page list, combined with the page lists from other Incoming Navigation data records defines one of more unique a linear navigation schemes for the document. The default scheme is always associated with a list id of 0.

Field | Bytes | Type | Notes
pagelists | 2 | Numeric | number of page list entries for this record.
pagelist data | 6*pagelists | Page List Data | Block of data containing an array of Page List Data (described below).

The page list data consists of a series of structures containing a list id followed by the unique ID of the previous and next records associated with that list id.

Field | Bytes | Type | Notes
list id | 2 | Numeric | the list id for this list. A list id of 0 should be used for the default linear ordering.
prev uid | 2 | Numeric | the uid of the previous record in the series for this list id or 0xffff if this is the first record in the series.
next uid | 2 | Numeric | the uid of the next record in the series for the list id or 0xffff if this is the last record in the series.

The hierarchy table specifies unique ID of each text record above this record in the document hierarchy that serves as an index leading to the current record.

Field | Bytes | Type | Notes
levels | 2 | Numeric | number of levels above the current record in the hierarchy.
hierarchy data | 2*levels | Numeric Array | This field is an array of 2 byte uids, each corresponding to the text record that serves as the index at a given level in the document hierarchy relative to the current record. The order of each uid in the array corresponds to the order of its corresponding string description in the string sequence below.
hierarchy strings | variable size | String sequence | An abbreviated string that identifies the level index. This string should be as short as possible, ideally only a few characters.

The topic table provides a list of topics associated with the record.

Field | Bytes | Type | Notes
topics | 2 | Numeric | number of topics in the topic string sequence.
topic strings | 0+ | String sequence | A concatenated sequence of one or more NUL-terminated ISO Latin-1 strings. Each string represents a topic associated with this text record.

### Mailto data records

The mailto data contains info about e-mail addresses that are referenced by the mailto anchors. All the offsets are counting from the end of the header.

Field | Bytes | Type | Notes
to offset | 2 | Numeric | offset to TO string
cc offset | 2 | Numeric | offset to CC string
subject offset | 2 | Numeric | offset to SUBJECT string
body offset | 2 | Numeric | offset to BODY string
strings | 0+ | String sequence | A concatenated sequence of one or more NUL-terminated US-ASCII strings. Each contains a header-value, which follows the contraints on header values laid down in IETF RFC 2822. Header folding is not allowed. Any of the four headers shown above may be absent; header values should be accessed via the above offsets.

### URL handling data records

Optionally, URL information for the records in the document may be stored. This information includes URL strings both for the pages actually included in the document, and for those pages excluded from the document. This information is conceptually stored as a sequence of strings, where the position of the URL in the sequence corresponds to the record ID of its page in the document. In the case of a page which is not actually included in the document, a pseudo-record-ID is assigned, greater than any actual record IDs in the document, and the URL of that page is associated with that pseudo-record-ID.

In practice, there are two kinds of records used to store the URL strings, the URL handling data record, which serves as an index into the sequence of strings, and the URL data record, one or more of which contain the actual strings.

For cross-document linking support, the URL strings must be of the format "doc://[external doc name]:[url]" where external doc name is the name of the external document and url is the URL string associated with a given record.

The URL handling data is used to find the record ID of the record which contains the correct URL string. It contains a series of 2 byte number pairs.

Field | Bytes | Type | Notes
last url | 2 | Numeric | the ordinal number of the last URL in record
id | 2 | Numeric | record ID for record

### URL data records

The URL data contains a list of the URLs. Additional records are created if needed and contain up to 200 URLs.

Field | Bytes | Type | Notes
URLs | 1+ | String sequence | a concatenated sequence of NUL-terminated URL strings following the constraints of IETF RFC 1738. The list may contain up to 200 URLs (only text and image records are included, other records are represented only by the presence of a NUL; that is, by an empty string)

These records may or may not be compressed. This is indicated by the type in the header. These records are used by the Details form to display the URL of the current record and by the External Reference form to display the URL of not collected pages. From either form you can copy the URL to a Memo to remind you to pluck it at a later date. For inter-document links, a paragraph link function may be specified to contain a pseudo-Record ID in place of an actual-Record ID, and an index into the external anchor names record in place of the paragraph number.

### External Bookmarks data records

The external bookmarks data contains a list of bookmarks added by the parser. It will work similar to named anchors.

Field | Bytes | Type | Notes
bookmarks | 2 | Numeric | number of bookmarks
offset | 2 | Numeric | offset to the start of the bookmark data (counting from the beginning of the record)
names | variable size | String sequence | A concatenated sequence of NUL-terminated strings, each a bookmark name
bookmark data | 4*bookmarks | Bookmark Data | block of data for the location of the external bookmarks (see below)

The bookmark data is a series of uid/offset pairs.

Field | Bytes | Type | Notes
uid | 2 | Numeric | unique ID for record
offset | 2 | Numeric | paragraph offset

### Default Category data records

Each Plucker document can be assigned to a number of named categories. This record stores the names of default categories for the document. The data consists of a concatenated series of NUL-terminated strings that should be used as the default category/categories for this document.

### Metadata data records

There should only be one of these per document. This record begins with a two byte numeric value, giving the number of subrecords that follow, followed by that number of subrecords. The subrecords are a sequence of tagged variable length items. Each subrecord consists of three fields:

Field | Bytes | Type | Description
type code | 2 | Numeric | Specifies what piece of extra information is in this subrecord
length | 2 | Numeric | Number of 2-byte words in the argument
argument | 2 * length | (type code specific) | Data

The following table describes the valid subrecord type codes, and describes the structure of the associated data for each subrecord type. Subrecords with unknown type codes should be ignored.

Type code | Name | Description | Argument
1 | CharSet | This is the character set and encoding used by text records in this document, unless otherwise specified for particular records. | a two-byte numeric value, specifying the IETF IANA MIBenum value for the character set. See the IANA registry of character sets for valid values.
2 | ExceptionalCharSets | This is a list of text records which use a charset other than that specified by the default CharSet. Note that if no default CharSet is specified, the default charset should be thought of as "unknown". | a sequence of (length / 2) record-ID, IANA-MIBenum pairs, where MIBenum values are as specified for CharSet. The invalid MIBenum value of 0 (zero) is used for records which have an unknown charset, if necessary.
Field | Bytes | Type | Notes
record ID | 2 | Numeric | unique ID for record
MIBenum | 2 | Numeric | IANA MIBenum for the character set used in this record
3 | OwnerID | This is the CRC-32 of the specified owner-id for the document, if any. Note that associating an owner-id with a document also affects the calculation of zlib compression. | a four-byte numeric value giving the CRC-32 of the owner-id string.
4 | Author | The name of the author of the document. | A string value in the document's default character set, padded at the end with NUL characters to an even number of bytes.
5 | Title | The full title of the document. | A string value in the document's default character set, padded at the end with NUL characters to an even number of bytes.
6 | PublicationDate | The date and time this document was created. | A 4-byte unsigned integer giving the number of seconds from 12:00 AM on January 1, 1904, to the time when this document was created.
7 | Linked Documents | The list of external documents that this document links to. | A concatenated sequence of NUL-terminated strings representing the document names for each external document linked to within this document. The string sequence should be padded at the end with NUL characters to an even number of bytes.

### Style Sheet data records

TBD

### Font Page data records

TBD

### Table data records

The Table Record describes an HTML table. It begins with a structure with the following format.

Field | Bytes | Type | Description
size | 2 | Numeric | Size of the following data
columns | 2 | Numeric | Number of columns the table contains
rows | 2 | Numeric | Number of rows the table contains
depth | 1 | Numeric | Bits per pixel (BPP) needed to render the table
border | 1 | Numeric | Draw table borders (0 = no, any other value = yes, 1 pixel wide)
border color | 4 | Numeric | RGB value of border color
link color | 4 | Numeric | RGB value of link color

This is followed by table row and table cell functions (their ends are implied). Each table cell function is followed by 'text length' (from the function) text, containing text and/or formatting functions. (Such as links, style, underline, strike through, italic, etc.)

### Page List Metadata data record

There should only be one of these per document. This record is used to assign the name and initial record associated with each page list in the document. Page lists are used to define the default ordering of pages within the document. More than one page list can be specified, which can be useful for defining tours through a document.

Field | Bytes | Type | Description
lists | 2 | Numeric | The number of page lists or tours in the document.
first record | 2 * sequences | Numeric Array | An array of uids corresponding to the first record in each page sequence. The zero based index into this array represents the sequence id or tour id. The first entry should be considered the default page ordering for the document.
list name | 1+ | String sequence | a concatenated sequence of NUL-terminated strings, each representing the name of a page list. The first entry in the list corresponds to the default page ordering. For unnamed page lists, a NUL charater should still be specified.

Page lists can be thought of as linked lists of records. The first record field in the Page List Metadata record is equivalent to the head pointer of the list. Each text record contains a previous/next record pointer within it's navigation metadata.

### Sorted URL Handling data record

The Sorted URL handling record is used to find the record ID of the Sorted URL data record containing data for a given URL string. It contains a series of 2 byte number pairs.

Field | Bytes | Type | Description
last URL | 2 | Numeric | the ordinal number of the last URL in record
id | 2 | Numeric | record ID for record

### Sorted URL data records

The sorted URL data record contains a list of URL/UID pointers sorted according to the lexicographical order of the URL strings pointed to by the url uid and url offset fields. This data is used in cross-document linking to facilitate a binary search of the URL strings in order to lookup the record ID for an incoming URL string. Only URLs for records actually contained in the document should be included in the Sorted URL data records. URLs for external records should be omitted.

Field | Bytes | Type | Description
url uid | 2 | Numeric | unique ID for URL data record that contains the sorted URL string.
url offset | 2 | Numeric | byte offset of the first character of the sorted URL string in the URL data record.
record uid | 2 | Numeric | unique ID of the text or image record that pertains to the sorted URL string.

### External Anchor Name Handling data record

The External Anchor handling record is used to find the record ID of the External Anchor data record containing a given external anchor string. It contains a series of 2 byte number pairs.

Field | Bytes | Type | Description
last anchor | 2 | Numeric | the ordinal number of the last anchor in record
id | 2 | Numeric | record ID for record

### External Anchor Name data record

The External Anchor data record is a string table containing the unique names for all external anchor name strings referenced in this document. These strings are used to query the record specific anchor name tables in a target book to determine a paragraph offset for cross-document linking. This information is conceptually stored as a sequence of strings, where the position of the anchor name in the sequence corresponds to it's index.

Field | Bytes | Type | Description
anchor name list | 1+ | String sequence | a concatenated sequence of unique NUL-terminated strings, each representing an anchor name from an external link found within this document.

These records may or may not be compressed. This is indicated by the type in the header. These records are used in conjunction with the Sorted URL Data records and record specific anchor name tables to facilitate cross-document linking.

© Copyright 2000 Michael Nordström <micke@sslug.dk> · Copyright 2001 Bill Janssen <bill@janssen.org | $Id: DBFormat.html,v 1.27 2005/10/29 14:14:21 nordstrom Exp $