Repository navigation
Verified Rendering
SIDHARTH SINGH edited this page Dec 3, 2026
·
1 revision
Normally, HTML-to-PDF systems hand bytes back to the caller and hope pagination or rounding did not drop a zero or clip a tax column. Because ONEX both renders PDFs and extracts invoices in one engine, it closes the verification loop automatically.
- Renders your HTML document cleanly using
toBuffer(). - Runs
extractInvoiceData()andextractText()on the generated bytes right inside Node. - Compares extracted totals, subtotals, tax totals, invoice numbers, PO numbers, Mod-36 GSTIN checksums, line-item sums, and required phrases against your
expectations. - If anything fails on pass one, retries once with forced bundled fonts and extra settlement wait time—then fails cleanly with
ONEX_RENDER_VERIFICATION_FAILEDif mismatches persist. - Writes a canonical SHA-256 content manifest (optionally signed with
hmacSecret) directly into the PDF's/MetadataXMP stream.
const out = await engine.renderVerified(invoiceData, html, {
format: 'A4',
hmacSecret: process.env.ONEX_AUDIT_SECRET,
expectations: {
grandTotal: 11800,
subtotal: 10000,
invoiceNumber: 'INV-2026-8842',
gstin: '27AADCB2230M1Z...',
verifyLineItemSum: true,
},
});
const audit = verifyIntegrity(out.bytes, { hmacSecret: process.env.ONEX_AUDIT_SECRET });Months later, calling verifyIntegrity() checks both text/field consistency against the embedded manifest and timing-safe HMAC verification without launching Chromium.
- Home
- Architecture & Render Pipeline
- PDF Internals & Extraction
- Unicode 16, Fonts & Legacy Indic
- Security & SSRF Model
- Digital Signing (
signPdf) - True Redaction (
redactPdf) - Semantic Diff & Redlines (
diffPdfs) - Self-Auditing Renders (
renderVerified) - PDF/A-3b & E-Invoices (
renderEInvoice) - HTTP, MCP, CLI & Puppeteer
Handbook & Deep Analysis: bahubalisid.github.io/onex