example · applications
Invoice Printer Example
Quick answer
Issue the invoice on the server, generate a versioned PDF from its immutable fiscal data, store its checksum, and print that artifact. Use the browser dialog for interactive printing or an authenticated local adapter for controlled workstation routing.
Quick answer
Issue the invoice on the server, generate a versioned PDF from its immutable fiscal data, store its checksum, and print that artifact. Use the browser dialog for interactive printing or an authenticated local adapter for controlled workstation routing.
type InvoiceArtifact = {
invoiceId: string;
version: number;
pdfUrl: string;
sha256: string;
issuedAt: string;
};
async function printInvoice(artifact: InvoiceArtifact) {
const jobId = `${artifact.invoiceId}:v${artifact.version}:${artifact.sha256}`;
// Interactive: open a same-origin PDF view and let the user print.
// A Portix-routed print path isn't documented yet.
return jobId;
}
Do not regenerate a historical invoice from current customer or catalog records. Corrections should create the legally appropriate new version, credit note, or replacement according to the jurisdiction. Validate any remote artifact URL and do not expose unrestricted local-runtime fetches.
Verify
- PDF page size, margins, fonts, and pagination are stable.
- Stored checksum matches the printed artifact.
- Duplicate requests reuse the logical job.
- Access control protects invoice URLs.
- Correction and reprint policies are auditable.
Related content
comparison
Raw Printing vs PDF Printing
Compare raw printer commands and PDF printing for receipts, labels, reports, portability, layout, drivers, speed, and maintenance.
guide
How to Print HTML
Create a dedicated printable HTML document, apply paged-media CSS, wait for assets, and print it safely from JavaScript.