PalmOS document formats

From MobileRead
Jump to: navigation, search

The Palm Operating System imposes some unique constraints on documents. The original Palm Pilot PDA held all programs and data in memory. Programs were run by a technique called "execute in place". Programs and data in PDA memory must be in Palm Database format. Generally speaking, Palm databases have either a PDB or PRC extension when saved on a disk drive file system. PDB files are data files. They may contain any content. PRC files are "Palm Resource Compiler" files, and are normally programs, but do not have to be. Some ebooks are provided in PRC files, such as older MobiPocket Reader documents..

The first record in a PalmOS database contains the database name and the database attributes. In particular, there will be an attribute defining the Creator: ID, which will be a unique four character identifier. Data files used by programs will have the same Creator ID as the program, and PalmOS and the program will use the Creator ID to know what files are used by what applications There is a table of IDs in the PDB page. The database name is at the very beginning of the file and is zero terminated clear text up to 32 bytes long.

[edit] PalmDOC

The first text file format widely used in Palm devices was the "doc" file, invented by a company called Aportis, and used by the AportisDoc reader. Despite being called "doc" files, they bear no relationship to Microsoft Word files. Palm doc files are plain ASCII text files which are compressed with a form of RLE compression to save space in memory. Doc readers decompress the files on the fly as they view them. The compression method used is "asynchronous": it is very fast to uncompress, but slow to compress, so doc files are usually created elsewhere and synced to the device. Compression on a doc file averages about 40%.

Aportis went out of business years ago, and the AportisDoc reader is no longer available, but the doc format was reverse engineered and is widely supported by other Palm programs. Most Palm document viewers and editors can display and/or edit doc files, as what as whatever native format they might use. PalmReader/eReader, MobiReader, WordSmith, and Document to Go, among others, can all display Palm doc files

[edit] zText

A more recent entry is zText files. These are plain ASCII TXT files similar to PalmDOC files, but they are compressed using Gzip compatible compression for smaller file sizes. Programs that can view zText files use sysZlib.prc, a PalmOS shared library port of the Zlib library from Linux, to provide decompression. Zlib compressed dopcuments average about 70% compression. Among others, LionDoc (based on CSpotRun), PalmFiction, and WeaselReader are capable of handling zText files. SysZlib is also used by the Plucker offline HTML viewer. See also ZTXT.

[edit] Palm Compression

Palm has a bit packed compression scheme that used 5 bits of data for the characters (txt). This is used primarily to store PQA data. The decode is as follows for the 32 values:

  • 6-31 contain lower case alphabet.
  • 5 is a space
  • 4 is a line break (carriage return)
  • 3 is a form feed (0x0C)
  • 2 is an escape - will be followed by a single ascii 8 bit character.
  • 1 is charstart - will be followed by a 8-bit tag id (ASCII) - This character (0x01) will also reset to 5 bit mode if currently in 8 bit mode.
  • 0 is charend - ends textZ and certain tags. It will also reset to 5 bit mode.
Personal tools

MobileRead Networks