Files
vectorcraft/crates/cdr
dotCooCoo 59db4313b1 File formats: open and place .cdr drawings, versions 1 to 27
File › Open and File › Place read .cdr drawings of versions 1 to 27,
and .cdt templates open as new untitled documents. A new L0 crate,
vectorcraft-cdr, reads the WL files of versions 1 and 2, the RIFF chunk
tree of versions 3 on with its compressed lists, and the ZIP packages of
versions 14 on with their data streams. The importer maps pages to
artboards side by side, layers by name, the master page's guidelines to
guides, groups, curves, paths, rectangles, ellipses, arcs and polygons
with uniform fills and outlines.

Versions 1 and 2 open as one page and one layer of rectangles, whole
ellipses and curves. Version 3 keeps transforms, fills and outlines in
each object, and a group's matrix places its objects; envelopes are not
applied, with a warning. Version 4 reads as version 5 with 12-byte u16
colors and fixed-point transforms.

Text, bitmaps, blends, contours, brush strokes, fountain, pattern,
texture and PostScript fills and arrowheads are left out, and the open
warnings name each kind in every complete catalog. RIFF files that name
a version before 3, drawings after 27 and encrypted, ZIP64 or split
packages are refused with a message. crates/cdr/PROVENANCE.md lists the
public source of each record layout.
2026-11-12 09:03:17 -08:00
..

vectorcraft-cdr

A bounded Rust reader for .cdr drawings of versions 1 to 27 (and .cdt templates). It reads the WL files of versions 1 and 2, the RIFF chunk tree of versions 3 and later with its compressed lists, the ZIP packages that versions 14 and later save (with the data streams of versions 16 and later) and the records listed below, and hands the engine a drawing in points, with each object's transform. It does not write .cdr files.

What is read

In the .cdr file Read as
ZIP packages: content/riffData.cdr (versions 14 and 15), content/root.dat with the data streams content/dataFileList.dat names (16 on) the RIFF chunk tree; a data stream is inflated only when a chunk the reader reads, or a list it splits, points into it
Pages, the page size in mcfg or a page's own size pages, laid out by the engine as artboards side by side
Layers (drawing, desktop, guides and grid layers), the master page's among them layers by name and kind
Guidelines (object type 0x16, and the version 7 guid chunk) guidelines at their point and angle
Groups (LIST grp ) groups
Curves (point lists of moves, lines and cubic curves) and paths (object type 0x25, version 16 on) paths
Rectangles (one corner radius, four from version 9) rectangles with each corner's radius
Ellipses, arcs and pies ellipses, and paths for arcs and pies
Polygons and stars (a base side copied for each side) paths
Uniform fills: CMYK, CMY, RGB, gray, registration, library colors colors, spot colors with their tints
Outlines: width, caps, joins, dashes, the no-outline flag outlines

Text, bitmaps, linked groups (blends, contours, brush strokes), B-spline curves, fountain, pattern, texture and PostScript fills and outline arrowheads are not read; the drawing's warnings name each kind it held. Drawings of versions after 27 are refused, and so are packages that are encrypted, ZIP64 archives or split across files.

Versions 1 to 4

No public specification covers these versions. The reader follows the published notes that PROVENANCE.md cites (rows R31 to R44), and the files of these versions it has read are the synthetic ones that src/synth.rs builds from those rows.

Version Read Left out or refused
1 and 2 (WL files) the page size; rectangles with one corner radius, whole ellipses and curves, each with its matrix; uniform fills and outlines with their width and color, in CMYK percent and the inks black and white. The objects come in on one page and one layer, front to back text and objects of other types, and ellipses whose two angles differ (arcs and pies), with the unsupported-objects warning; fills of other types, with the unsupported-fills warning; inks of a numbered library, which read as spot colors without a look; groups and layers, whose records are passed over; dashes, caps, joins and arrowheads, which the notes do not place
3 (RIFF, form type CDR ) the page size from the page's corners; pages, layers and groups; rectangles, ellipses, arcs and curves with the matrices of the object and of the groups around it; uniform fills; outlines with their width, color, caps, joins and dashes text and bitmaps; envelopes, with the envelopes warning (the objects and groups under one keep their outlines and matrices); fountain, pattern and texture fills; arrowheads
4 (RIFF, form type CDR4) as version 5, with the colors and the fixed-point transforms of version 4 as version 5

A file is taken for version 1 or 2 by its content only when, after WL, its marker byte is one of d, e and m, the next byte is zero, and the record offsets of its header fit the file. The reader reports version 2 for the marker m and version 1 for the other two. A RIFF file that names a version before 3 is refused, and so is the version 4 template form type CDST, which reads as not a .cdr drawing.

Provenance

PROVENANCE.md lists every record layout the reader relies on, with its public source and status. Code cites the rows by id (R1 ...), and tests/provenance.rs fails when a cited id has no row. The test inputs are synthetic drawings built by src/synth.rs (the synth feature); no third-party file is committed.

Limits

Limits bounds the input size, the bytes inflated from compressed lists and package members, the size of one package member, the number of members, the nesting depth, the chunk count, the objects, the coordinates and the outline dashes of one read. Past a limit the reader stops with an error or leaves the rest out with a warning; it does not recurse and does not panic. Each record of a version 1 or 2 file counts toward the chunk count, and the transform entries of a version 3 object are held to the arguments one record may have. A package's data stream is read once however many lines of content/dataFileList.dat name it. A redirected list whose bytes overlap those of an earlier redirected list is left out with the damage warning. Other records may share bytes, and the bytes read again may add up to the member limit; past it the records are left out with the limit warning.