Craft Language Reference
The Craft Language is an XML-based markup language for defining Docraft documents. Each XML tag maps to a visual element that the library parses, layouts, and renders to PDF.
Write declarative, readable document templates without touching low-level drawing APIs.
Core Elements
The foundation — <Document>, <Header>, <Body>, <Footer>
sections and how they compose pages automatically.
Styled text with fonts, sizes, colors, alignment, bold, italic, underline, and justified text support.
Visual Elements
Geometric primitives — <Rectangle>, <Circle>, <Triangle>,
<Line>, <Polygon> with fill and stroke styling.
Embed PNG and JPEG images from files, or inject raw pixel data at runtime via the template engine (including base64).
Complex Structures
Grid-based tables with column titles, row/column weights, cell backgrounds,
and automatic JSON data binding via <Foreach>.
Ordered and unordered lists — number, roman numeral, alphabetic, dash, star, circle, and box markers.
Nested <Layout> containers with horizontal/vertical orientation
and weighted child distribution for multi-column designs.
Data binding with ${variables}, <Foreach> loops, conditional
rendering, and JSON model integration for dynamic documents.
Configuration
Page format (A3, A4, A5, Letter, Legal), orientation (portrait/landscape), custom fonts, and section height ratios.
Document properties — title, author, subject, keywords, creation date, and automatic keyword extraction from content.