CorelDRAW 3 to X3 save a drawing as a RIFF file, and the drawing inside the ZIP packages of X4 and later is the same kind of stream. This page describes the chunks and lists as libcdr reads them, and as they appear in a CorelDRAW 6 file. Corel has not published any of it. All numbers are little-endian.
Chunks
Every chunk has the same eight-byte header. A reader should step over zero bytes before a header, as libcdr does: a chunk of odd length is followed by one.
| Offset | Size | Field | Description |
|---|---|---|---|
0 | 4 | ID | Four ASCII characters, for example vrsn, loda or bmp with a space. |
4 | 4 | Length | The bytes of data after this field. Inside a compressed list it is an index into a table of lengths instead. |
8 | length | Data | For RIFF and LIST, a four-character list type and then more chunks; for any other ID, the chunk’s own fields. |
File header
0IDRIFF4 bytes4Length the rest of the file, from offset 84 bytes8Form typeCDR(orcdr) and the version character4 bytes12Chunksvrsnfirst, then the rest of the drawingvaries
| Character at offset 11 | Version | vrsn value |
|---|---|---|
| space | CorelDRAW 3 | 300 |
4 to 9 | CorelDRAW 4 to 9 | 400 to 900 |
A, B, C | CorelDRAW 10, 11, 12 | 1000, 1100, 1200 |
D | CorelDRAW X3 | 1300 |
E and later | X4 and later, inside the ZIP package | 1400 and up |
vrsn: version
The first chunk. Its data is one unsigned 16-bit number, 100 times the major version. libcdr takes the version from here and uses it to decide how every later record is laid out; below 600 it reads coordinates and counts as 16 bits, from 600 as 32 bits.
| Offset | Size | Field | Description |
|---|---|---|---|
0 | 2 | Version | For example 58 02, 600, for CorelDRAW 6. |
The tree
After vrsn and DISP, a CorelDRAW 6 file has a
LIST doc of document tables, then one LIST page for each
page. A page holds its flags and its layers; a layer holds its flags and its objects;
an object holds its flags, its box and a list of its parts.
RIFF CDR6
vrsn
DISP preview picture
LIST INFO IKEY, ICMT
LIST doc
mcfg page size and settings
LIST fntt font chunks
LIST filt fill chunks
LIST otlt outl chunks
LIST stlt styles
LIST page one for each page, and one more first
flgs
LIST gobj
LIST layr
flgs
LIST lgob
LIST obj or LIST grp for a group
flgs
bbox
usdn
LIST lgob
loda the object's shape and the ids of its fill and outline
LIST trfl
trfd the object's transformation
libcdr does not draw a page whose flags have a non-zero third byte. In the
CorelDRAW 6 file seen, only the first page list is marked so, and it has more layers
than the others. Later versions keep the same lists but put most of them inside a
cmpr list.
List types
| List type | Holds |
|---|---|
doc | Document settings (mcfg) and the tables of fonts, fills, outlines, styles, arrowheads and bitmaps. |
fntt | The font table: font chunks. |
filt | The fill table: fill chunks (libcdr also reads fild). |
otlt | The outline table: outl chunks. |
stlt | Styles. Up to CorelDRAW 6 a list of chunks; from CorelDRAW 7 libcdr reads it as one record. |
page | A page: flgs and its layers. |
gobj | The layers of a page, in CorelDRAW 6. |
layr | A layer: flgs and its objects. |
obj | An object. |
grp | A group: the objects in it, and its own transformation. |
lgob | The parts of a layer, object or group. |
trfl | An object’s transformations: trfd chunks. |
cmpr | A compressed list. |
INFO | Standard RIFF information chunks such as IKEY and ICMT. |
Chunk IDs
| ID | Holds | Described |
|---|---|---|
vrsn | The version. | above |
DISP | The preview picture. | Preview picture |
mcfg | Document settings, with the page size. | below |
flgs | Flags of a page, layer or object. | below |
bbox | An object’s bounding box. | below |
loda, lobj | An object’s shape and the ids of its fill, outline and style. | Objects |
trfd | A transformation matrix. | Objects |
fill, fild | A fill. | Fills |
outl | An outline. | Outlines |
font | A font. | Fonts |
bmp | A bitmap used by bitmap objects. | Bitmaps |
arrw | An arrowhead shape. | not here |
txsm | Text and its formatting. The layout changes in almost every version. | not here |
styd | A style definition. | not here |
usdn, obbx, spnd, uidr | An object’s number, oriented box, spline data and unique id. | not here |
ole2, olel | An embedded OLE object (a compound file, D0 CF 11 E0) and its link. | not here |
cmx1 | In the CorelDRAW 6 file seen, the drawing again as a Corel Presentation Exchange (CMX) file: RIFF with form type CMX1. | not here |
ccmm | Not known. | not here |
mcfg: page size
libcdr reads only the page size from this chunk. Where it is depends on the version; what the bytes before and after it hold is not known.
| Version | Bytes before the size | Then |
|---|---|---|
| 3 | 2 | Four coordinates: left, bottom, right, top. The size is the difference. |
| 4 and 5 | 0 | Width, then height, as coordinates. |
| 6 | 28 | Width, then height. |
| 7 and 8 | 0 | Width, then height. |
| 9 to 12 | 4 | Width, then height. |
| X3 and later | 12 | Width, then height. |
A coordinate is a signed 16-bit number of thousandths of an inch up to version 5, and a signed 32-bit number of 1/254,000 inch from version 6. The page’s centre is the origin, and y grows upwards.
flgs: flags
Four bytes, read as an unsigned 32-bit number. libcdr uses two things in them. A
page whose flags have a non-zero third byte (flags & 0x00FF0000) is
not drawn. A layer whose third byte is zero and which has bit 0x100 set
is not drawn either. What the other bits mean is not known.
bbox: bounding box
| Offset (6 and later) | Size | Field |
|---|---|---|
0 | 4 | x of one corner |
4 | 4 | y of that corner |
8 | 4 | x of the opposite corner |
12 | 4 | y of the opposite corner |
Up to version 5 each coordinate is 2 bytes, so the chunk is 8 bytes.