The K2F format operates on a dual-state architecture: an editable, declarative semantic JSON tree (State A) and a compiled, pixel stable lock (document.K2F.lock / State C) packaged inside a self-contained ZIP archive. While PDF achieves visual stability by freezing procedural drawing commands (BT ... TJ, vector paths, subsetted fonts) on an absolute Cartesian plane without native semantic structure—making automated editing by AI agents prone to text overlap, clipping, and missing glyphs—K2F compiles semantic intent into deterministic geometry using a dedicated Rust reference layout engine (k2f_layout), strictly isolating content meaning from visual theme primitives and mandating embedded fonts.
K2F is not a lossless superset of PDF. K2F v0.1 does not import or convert existing PDF files (PDF_IS_NOT_A_SOURCE), does not support arbitrary Bézier vector art directly in State A, lacks prepress CMYK separation plates and spot colors (Pantone) for commercial printing (PDF/X), does not support embedded Acrobat JavaScript execution, and does not implement specialized ISO profiles like PDF/E for 3D engineering models or certified PDF/A archives. All export formats derived from K2F are unidirectional deliverables rendered from the compiled lock rather than round-trip sources of truth.
At a glance
| Topic | K2F | |
|---|---|---|
| What the file is | Procedural 2D vector drawing stream and object graph (ISO 32000) on an absolute Cartesian plane | Declarative semantic JSON tree (State A) + compiled render lock (State C) in a ZIP archive |
| Primary authoring model | Export-only destination ("Print to File") compiled from word processors, DTP, or web engines | Programmatic authoring, inspection, and patching by AI agents and automated code pipelines |
| Rendering architecture | Pre-baked drawing commands executed by 2D graphics rasterizers (Acrobat, PDFium, PDF.js, Quartz) | Dual-state model: viewers paint pre-compiled document.K2F.lock directly without reflowing text |
| Pixel-stable pages & fonts | High visual stability, but rasterizer variances (antialiasing, blend modes) and font-substitution drift | Yes — viewers paint the lock directly; mandatory embedded fonts guarantee cross-device pixel stability |
| Node addressing for AI | Zero native semantic IDs; text trapped in drawing commands; requires fragile coordinate scraping | Mandatory, hierarchical dotted IDs (parent_id.child_type_semantic_name) on every semantic node in State A |
| Text modification & reflow | No native reflow; expanding text collides with neighboring content or clips off the page edge | Engine automatically recalculates geometry, line wraps, and page budgets; verified via pack_verify |
| Font embedding & encoding | Frequently embeds subsetted fonts with custom CMaps; inserting new characters risks missing-glyph tofu | Mandatory complete embedded fonts (fonts/); standard text shaping (HarfBuzz) and Unicode NFC normalization |
| Separation of concerns | Zero native style abstraction; font, size, and color are procedural commands emitted before glyphs | Strict separation: zero styling on State A nodes; visual primitives live exclusively in styles/theme.json |
| Theming & global restyling | Virtually impossible without parsing and rewriting all procedural color and font operators | Single token change in styles/theme.json restyles entire document deterministically upon recompilation |
| Version control & diffs | Opaque binary file; Git diffs are unreadable; merging simultaneous edits requires specialized software | Git-native Canonical JSON (clean semantic diffs); optional changelog.json; node-level patch and rollback |
| Interactive forms | Established AcroForm ecosystem (/Tx, /Btn, /Ch) across compliant visual viewers | Native form_field semantic nodes compile directly into genuine interactive AcroForm PDF exports |
| Arbitrary vector art | Native arbitrary 2D vector drawing: Bézier curves, clipping paths, mesh gradients, and blend modes | Forbidden in State A JSON; external vector graphics stored as pre-rendered SVGs or images in /assets/ |
| Prepress & commercial print | Native prepress standard (PDF/X, ISO 15930), CMYK separations, spot colors (Pantone), bleed/slug, trapping | RGB and hex color palette support in themes; no native CMYK separations or spot color plates in v0.1 |
| Multi-format supply chain | Single deliverable format; reverse conversion to editable Word, PPT, or InDesign is lossy and heuristic | Single-source lock-drawn exports to PDF (with AcroForms), Microsoft Word (.docx), PowerPoint (.pptx), and InDesign (.idml) |
| Integrity & signatures | Standardized PKCS#7 / PAdES byte-range signatures; verifies raw bytes, vulnerable to visual shadow attacks | Dual-hash architecture (content_hash, appearance_hash), Ed25519 signatures, mandatory viewer banner (SIGNED, UNSIGNED, SIGNED_BUT_BROKEN, BROKEN_INTEGRITY, UNLOCKED) |
| Import / Source of truth | Output deliverable; becomes accidental "orphan source" when original authoring files are lost | .K2F is sole source of truth; K2F does not import PDF (PDF_IS_NOT_A_SOURCE); exports are read-only drawings of the lock |
PDF vs K2F: What PDF is good at
PDF remains the undisputed global standard for final-form digital document distribution, commercial printing, and legally binding document archiving:
- Universal viewer ubiquity: Pre-installed on virtually every operating system, smartphone, web browser (Chrome, Safari, Edge, Firefox), and hardware device worldwide. Recipients never need specialized software, accounts, or layout engines to open and inspect a PDF.
- Unrestricted 2D vector graphics model: Full, arbitrary 2D vector drawing capabilities: cubic Bézier paths, complex clipping masks, transparency blend modes, isolated transparency groups, soft masks, and mesh gradients. It can visually represent any design capable of being rendered or printed.
- Global commercial prepress and printing standard (PDF/X): PDF/X (ISO 15930) is the foundational standard for commercial offset and digital printing. It natively supports CMYK color spaces, spot color systems (Pantone), ink trapping networks, separation plates, and exact printer marks (bleed, slug, crop, and registration marks).
- Long-term legal and archival preservation mandates (PDF/A): PDF/A (ISO 19005) is legally mandated by courts, patent offices, national archives, and regulatory bodies worldwide. It guarantees that documents can be reproduced identically decades into the future by strictly prohibiting external font linking, dynamic scripts, and device-dependent color spaces.
- Legally recognized digital signatures (PAdES / eIDAS): Mature digital signature infrastructure based on ISO 32000 and PAdES (ETSI EN 319 142). PDF supports byte-range hashing, Document Modification Detection and Prevention (DocMDP), long-term validation (LTV/DSS), and multi-party incremental signing recognized under global regulatory frameworks (eIDAS, ESIGN Act).
- Pre-baked, layout-free rendering: Because layout geometry is pre-computed upstream at authoring time, PDF viewers require no layout engine, no typography reflow logic, and no knowledge of semantic document structure.
- Interactive AcroForms: Established ecosystem for interactive form filling (text inputs, checkboxes, radio buttons, dropdowns, signature fields) across all compliant desktop and mobile viewers.
What K2F adds
K2F is designed for workflows where automated systems and AI agents require deterministic structure, verifiable rendering, and multi-format delivery:
- Declarative semantic tree & stable dotted IDs: Every node in State A (
content/root.json) carries a mandatory, hierarchical dotted ID (e.g.,financials.q3_results.table_revenue,contract.clauses.clause_4_indemnity). AI agents target, read, patch, diff, and revert specific content nodes deterministically without scraping visual coordinates, parsing geometry, or guessing reading orders across multi-column layouts. - Deterministic layout compilation & automatic reflow: In PDF, layout is frozen at export time; replacing a short sentence with a longer paragraph causes text to collide with adjacent content or clip off the page edge. K2F strictly separates semantic intent from visual geometry. Modifying text in State A and recompiling via the Rust reference engine (
k2f_layout) automatically recalculates bounding boxes, wraps lines, and re-paginates content without layout destruction. Automated verification scripts (pack_verify) ensure the compiled package conforms to format schemas before delivery. - Pre-compiled pixel-stable lock (
document.K2F.lock): K2F pairs an editable semantic tree with a compiled render lock (State C). Official viewers (<k2f-viewer>, Desktop Reader) paint the published lock directly without running layout or reflowing body text in the browser. Mandated embedded fonts (fonts/) and pinned engine identity (appearance_hash) eliminate font substitution and cross-rasterizer visual drift. - Strict intent-presentation separation & global restyling: PDF has no stylesheet or design token abstraction; visual attributes (font, size, color) are procedural commands emitted immediately before each glyph run. K2F strictly forbids inline styling on State A nodes; appearance is governed entirely by
styles/theme.json. A single prompt or theme token restyles an entire document deterministically upon recompilation without risking layout corruption. - Font embedding & Unicode safety: PDF generators routinely embed subsetted fonts with custom CMaps, trapping AI agents in missing-glyph errors ("tofu") when inserting new characters. K2F mandates complete embedded fonts, HarfBuzz text shaping (
rustybuzz), Unicode line breaking (UAX #14), and NFC normalization. - Dual-hash cryptographic integrity & mandatory viewer banner: Standard PDF signatures sign raw byte streams, leaving documents vulnerable to visual Shadow Attacks where different viewers display conflicting terms under a "Valid" signature. K2F implements a dual-hash architecture:
content_hashhashes the semantic tree, whileappearance_hashbinds content, theme, embedded fonts, page setup, and the pinned reference engine identity (engine_commit_sha). Official readers enforce a mandatory integrity banner reporting five canonical states (SIGNED,UNSIGNED,SIGNED_BUT_BROKEN,BROKEN_INTEGRITY,UNLOCKED), while reporting runtime layout engine discrepancies (ENGINE_MISMATCH). - Git-native collaboration & semantic diffs: Standard PDF files are binary streams with Deflate-compressed object streams and byte-offset XRef tables, making Git diffs opaque binary blobs. K2F source trees are maintained as Canonical JSON (alphabetically sorted keys, 2-space indentation), enabling AI agents and human engineers to review clean semantic diffs, resolve merge conflicts, and audit changes node by node.
- Native AcroForm PDF generation: K2F's
form_fieldsemantic nodes compile directly into genuine interactive AcroForm PDF fields upon export, bridging agent-generated form logic with universal PDF distribution. - Single-source multi-format publishing: A single
.K2Fdocument compiles once to produce lock-drawn deliverables for PDF (with AcroForms), Microsoft Word (.docx), PowerPoint (.pptx), and Adobe InDesign (.idml). - Agent tooling and template ecosystem: K2F provides an official agent skill implementing the
agent_v0authoring dialect, automated schema verification utilities (pack_verify), and a public Gallery of 469+ templates on k2f.dev with multi-format downloads (.K2F,.docx,.pptx,.idml) without requiring accounts or subscriptions.
When to pick which
-
Pick PDF when:
- The deliverable is a final, read-only digital drawing, prepress print file, or legal archive where content will never be edited programmatically by node ID.
- Workflows require commercial offset printing with CMYK separations, spot colors (Pantone), ink trapping, and printer marks (PDF/X).
- Regulatory mandates strictly require certified long-term archival profiles (PDF/A) or legally binding PAdES / eIDAS enterprise signatures (Adobe Sign, DocuSign).
- Documents contain complex, arbitrary 2D vector artwork, technical schematics, or CAD models (PDF/E).
- Universal, zero-install viewing across legacy hardware and consumer devices is the paramount priority.
-
Pick K2F when:
- AI agents and automated software pipelines must generate, inspect, patch, or restyle documents programmatically using stable dotted node IDs with schema validation (
pack_verify), avoiding fragile coordinate scraping and missing-glyph errors. - Documents require both the editable semantic flexibility of source code and the strict pixel stability of a compiled lock (
document.K2F.lock). - Organizations need to publish from a single source to PDF (with interactive AcroForms), Microsoft Word, PowerPoint, and Adobe InDesign simultaneously.
- Workflows require Git-native semantic version control with human-readable diffs, theme-driven re-skinning without content edits, and cryptographic tamper-evident integrity banners.
- AI agents and automated software pipelines must generate, inspect, patch, or restyle documents programmatically using stable dotted node IDs with schema validation (
-
Exporting from K2F to PDF:
- Use K2F as the AI-native authoring source, then export a PDF (
k2f export-pdf) when distributing read-only documents, submitting forms (via native AcroForms), or sharing files with external counterparties. Deliverables exported from K2F are unidirectional drawings of the compiled lock, not editable sources of truth (PDF_IS_NOT_A_SOURCE). All authoritative structural edits must occur in K2F State A.
- Use K2F as the AI-native authoring source, then export a PDF (
Bottom line
For additional details on K2F architecture, explore the technical documentation, review pre-built templates in the Gallery, read why K2F exists, or view the full matrix on Compare.
This comparison is based on publicly available information at the time of writing. Capabilities, pricing, and policies may change; verify details with the relevant provider.