🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@intenttext/pdf

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@intenttext/pdf

Server-side PDF generation for IntentText (.it) documents — merge, seal, and render real PDF bytes for emailing and archiving. Opt-in companion to @intenttext/core.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@intenttext/pdf

Server-side PDF generation for IntentText (.it) documents — for the moments no human is at a browser: emailing an invoice, archiving for compliance, month-end batch statements.

@intenttext/core stays zero-dependency; this is the opt-in enterprise companion.

npm i @intenttext/pdf
# plus ONE of:
npm i puppeteer        # bundles Chromium — zero config
npm i puppeteer-core   # uses your existing Chrome (set CHROME_PATH if not auto-found)

The enterprise "issue" flow — one call

Merge data into the template → seal the merged document (tamper-evident SHA-256) → real PDF bytes:

import { issuePDF } from "@intenttext/pdf";

const { source, hash, at, pdf } = await issuePDF(template.source, invoiceData, {
  signer: "Jadwal Billing",
  role: "Finance",
  theme: "corporate",
});

await db.invoices.updateOne({ _id }, { $set: { itSource: source, itHash: hash, issuedAt: at } });
await s3.putObject({ Key: `invoices/${number}.pdf`, Body: pdf });   // archive what was sent
await mailer.send({ attachments: [{ filename: `${number}.pdf`, content: pdf }] });
  • source — the sealed .it text. Store it on the record: it's the queryable, hash-verifiable legal artifact (a few KB of text). Years later, verifyDocument(source) from @intenttext/core proves it unaltered.
  • pdf — the bytes you email/archive.
  • Unresolved {{fields}} render blank (it's a finished document), pass missing: "keep" to override.

Without Chrome in this process (Gotenberg & friends)

issueDocument() is the same flow minus the PDF — pure, synchronous, no Chrome:

import { issueDocument } from "@intenttext/pdf";

const { source, hash, html } = issueDocument(template.source, data, { signer: "Jadwal Billing" });
// POST `html` to your HTML→PDF sidecar (e.g. Gotenberg), store `source` yourself.

Other entry points

import { renderPDF, htmlToPDF, createPdfRenderer } from "@intenttext/pdf";

await renderPDF(itSource, { theme: "corporate" });   // finished .it → PDF bytes
await htmlToPDF(printHtml);                           // bring-your-own HTML → PDF bytes

// Batch (reuses one Chrome — launching costs ~1s):
const r = await createPdfRenderer({ theme: "corporate" });
for (const s of statements) {
  const { pdf } = await r.issuePDF(tmpl, s, { signer: "Jadwal Billing" });
  await s3.putObject({ Key: `statements/${s.id}.pdf`, Body: pdf });
}
await r.close();

Chrome resolution

  • puppeteer if installed (its bundled Chromium).
  • puppeteer-core + a binary from: executablePath option → $PUPPETEER_EXECUTABLE_PATH$CHROME_PATH → common install paths (macOS/Linux/Windows).
  • Neither → a clear error telling you what to install.

In containers, pass launchArgs: ["--no-sandbox"] if your image requires it.

Docs

Full integration guide (storage model, Mongo shapes, receipts, Arabic/RTL): ecosystem → ERP / App Integration in the IntentText docs.

Keywords

intenttext

FAQs

Package last updated on 12 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts