Generate PDFs in the browser¶
Render an invoice or report in your web application with fullbleed/browser.
The engine runs in a Web Worker and returns PDF bytes and optional PNG previews.
Your application can download the result without a PDF server or service account.
Open the live starter Edit source online Download the project
The starter includes a designed invoice and a three-page community report. Change the customer, reference, and ink color, or open Edit the HTML & CSS to paste your own template. Generate a preview, then download the actual PDF. Use Save HTML and Save CSS beneath the editor to keep your template edits. The Download starter link in the demo opens the complete application project. All sample names, organizations, and amounts are fictional.
The downloadable starter uses npm package 0.8.4, wrapping Fullbleed engine 2.5.40. The browser and Node entries share the pinned engine and bundled fonts.
Unembedded Helvetica, Times, and Courier faces produce visible PNG previews, including in templates pasted into the starter. The font-preview guide explains the substitute designs and upgrade checks. Run the asset-copy command again after upgrading so the browser receives the matching runtime and notices.
Package 0.8.4 uses engine 2.5.40. Underlines, overlines and strikethroughs continue across collapsed word spaces and retain inherited decorations through nested spans. See the text-decoration checks. It also includes the earlier quotation, table-wrapping and pagination fixes. For an existing project, follow the current browser installation guide and recopy the browser runtime after upgrading.
Edit the project online¶
Choose Edit source online, then Open in StackBlitz. It opens the same source files and dependency lockfile as the ZIP, installs the dependencies, and starts the app. You can try it without an account or a local Node installation.
Change src/invoice.html or src/invoice.css in the code editor. Vite reloads
the app with the updated template; use Generate PDF, then Download PDF,
to open the result. The app's Edit the HTML & CSS panel also lets you test
template changes without changing the project files.
Online edits are temporary unless you save or export your project in StackBlitz. For a project you control locally, download the ZIP and follow the steps below.
Run the starter¶
Extract the project ZIP. With Node.js 22.12 or newer, open a terminal in
fullbleed-browser-starter and run:
Open the localhost URL printed by Vite. The first render loads the engine and fonts from your development server. Document inputs are sent to the worker in the same browser; this starter does not upload them to a rendering service.
The HTML/CSS editor keeps changes in the tab until reload. Choose Save HTML
and Save CSS to download the selected template's current source. The files
keep your edits and placeholders, even if you have not rendered them yet or the
last render failed. Put the saved invoice.html / invoice.css or
report.html / report.css in the downloaded project's src/ folder. You can
also edit those project files directly. The invoice uses {{customer}} and {{reference}}
in HTML and {{ink}} in CSS; src/main.js fills those values and escapes text.
Replace the fictional line items and calculations when building your application.
Add rows to the HTML invoice¶
Add <tr> rows inside src/invoice.html's <tbody> and update both sample
totals. The HTML template does not calculate amounts. It can continue onto new
pages with repeated column headings and Page N of M footers. Keep the @page
margins and .closing group in src/invoice.css; that group holds the totals
and payment details together, moving them to a new page when needed.
The invoice checks cover the short sample, 24 rows, wrapped descriptions, empty rows and page boundaries. The 24-row sample produces three pages, with all text inside the PDF page bounds.
Add the browser SDK to an existing app¶
Install the package and copy its runtime into the directory your framework serves as static files:
Import the browser entry in your client code:
import { createRenderer } from 'fullbleed/browser';
const renderer = createRenderer({ assetBaseUrl: '/fullbleed/' });
const result = await renderer.renderPdf({
html: '<h1>Invoice NS-1042</h1><p>Consulting: USD 1,200.00</p>',
css: '@page { size: A4; margin: 20mm } h1 { color: #175c52 }',
previewDpi: 96,
maxPages: 20,
timeoutMs: 30_000,
});
const url = URL.createObjectURL(new Blob([result.pdf], { type: 'application/pdf' }));
const link = document.createElement('a');
link.href = url;
link.download = 'invoice.pdf';
link.click();
setTimeout(() => URL.revokeObjectURL(url), 60_000);
Run rendering from a user action and show loading, error, and cancellation states.
The starter implements those states, clears outdated downloads after edits, and
releases replaced preview URLs. Pass an AbortController's signal to
renderPdf() to connect a Cancel button.
The asset-copy command verifies the installed runtime before writing it. Deploy the client, worker, engine, fonts, and notices together; repeat the copy when upgrading. A version mismatch returns a structured error.
Deploy a static site¶
Build the starter with:
Upload the entire dist/ directory to a static host. The example uses relative
asset paths and is checked under a nested URL prefix. For another application,
set assetBaseUrl to its same-origin runtime directory, ending in /—for
example, /my-app/fullbleed/.
Use HTTPS or localhost with Web Workers, WebAssembly, and Web Crypto available. The deployed site needs no Node process. The browser API guide covers content security policy, custom fonts and images, options, and errors.
Scope and verification¶
Use Fullbleed's supported print CSS. This API consumes static
HTML/CSS; document scripts do not execute, and document URLs do not become
browser fetches. Supply extra images and fonts as bytes through assets and
fonts. Rendering a live website requires a different workflow.
Each call creates a fresh worker. Deadlines include startup and asset loading; completion or cancellation requests worker termination before the promise settles. Browsers do not expose a native thread-exit promise. Keep concurrent jobs bounded for the devices you support, especially when generating page previews.
The 0.8.4 release evidence retains checks in Chrome, Firefox, and Playwright WebKit, including PDF/PNG comparison with the installed Node package, independent PDF text checks, cancellation, damaged assets, and recovery. Playwright WebKit is not branded Safari certification. This browser API covers ordinary PDFs and previews; PDF/A, PDF/UA, PDF/X, and VDP are not exposed here.
For a server application, use the Node.js API or the Next.js download starter. For a quick experiment without installing a project, use the HTML/CSS playground.
For a React client application, use the React and TypeScript starter. For a Vue client application, use the Vue and TypeScript starter with a reusable composable, reactive previews, and component cleanup. It connects form changes to automatic PDF previews and includes a hook that cancels stale work and releases output URLs when inputs change or a component unmounts.
The editor checks also paste templates for sibling counter resets, nested clipping, SVG border-image centers, and decorated floated initials. They inspect downloaded PDF text and independently specified colors in both the PDF and its preview.
Nested quotation checks cover inline, block, and contents layouts through the actual editor. They check both PDF readers, page size, and visible preview output. The retained starter verification records the earlier editor cases and their original invoice and report downloads. The invoice checks above cover the flowing template in the current download.