API Reference
Complete C++ API documentation for Docraft — auto-generated from source code comments. Explore the library’s modules below to understand how to build, layout, and render PDF documents.
Core Components
The main entry point — DocraftDocument owns the document tree, metadata,
and drives the entire rendering pipeline.
Runtime context and cursor management — tracks the current rendering position, page boundaries, and layout state.
Document Model
Base classes for all document elements — DocraftNode, DocraftText,
DocraftImage, and structural components like Header, Body, Footer.
Geometric primitives — Rectangle, Circle, Triangle, Line,
Polygon with fill, stroke, and border styling.
Layout containers — DocraftLayout (horizontal/vertical), DocraftTable,
DocraftList (ordered/unordered) for composing complex structures.
Common types, enums, and data structures — TextStyle, TextAlignment,
PageFormat, Orientation, and more.
Rendering Pipeline
Flow-based layout system with automatic page breaking — calculates positions and sizes for all document nodes before rendering.
The rendering coordinator — traverses the document tree and delegates drawing operations to specialized painters.
Specialized painters for each element type — TextPainter, ShapePainter,
ImagePainter, TablePainter, etc.
Abstracted PDF backend interface — currently implemented with libharu
but designed to be pluggable.
Template & Parsing
XML parser for the Craft Language — converts .craft files into
a document object model using pugixml.
Data binding and template expansion — ${variables}, <Foreach> loops,
conditional rendering, and JSON model integration.
Utilities
Helper functions for color parsing, string manipulation, font management, base64 decoding, and file operations.