Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A blank pdfmake file usually means the problem is in one of four layers: the document-definition object has no usable content, the browser loaded the wrong scripts or fonts, your code uses an API that does not match the installed pdfmake version, or a layout rule created an empty page. Check those layers in that order. Start with a minimal document, verify pdfmake.min.js and vfs_fonts.js, confirm font registration and version-specific output methods, then isolate page-break features.

1. Prove that the document definition contains content

pdfmake is declarative: the object passed to pdfMake.createPdf() describes what should be laid out. If that object is empty, undefined, or not the object you think it is, a valid-looking PDF can contain no visible content. The project’s minimal example is:

const docDefinition = {
  content: 'This is an sample PDF printed with pdfMake'
};

pdfMake.createPdf(docDefinition).download('sample.pdf');

Use the smallest possible definition before debugging your real report:

  1. Log the value immediately before generation: console.log(JSON.stringify(docDefinition, null, 2));.
  2. Confirm it is an object, not a Promise, string containing JSON, or an earlier variable that was overwritten.
  3. Confirm content is present and contains text, an image, a table, or another supported node.
  4. Generate the minimal sample and open the downloaded file in a current PDF viewer.

If the sample works, add your real content back one section at a time. This identifies whether data mapping produced an empty array, a conditional branch removed all nodes, or a malformed table is responsible. The official project overview documents the document-definition approach: pdfmake on GitHub.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Adobe Acrobat 6 PDF For Dummies
  • Used Book in Good Condition

Common definition mistakes

  • Passing createPdf() the wrong variable, such as the result of an asynchronous data call rather than the resolved definition.
  • Building content with a filter that returns [] for every record.
  • Using an unsupported or misspelled node property, so the intended visible value never reaches the layout.
  • Putting text in application state but never copying it into docDefinition.content.

Keep a known-good text node in the definition while testing. Remove it only after the generated file is visible.

2. Verify the browser scripts and their load order

The official client-side setup calls for both the pdfmake library and its virtual file-system font bundle. The usual browser includes are:

<script src="pdfmake.min.js"></script>
<script src="vfs_fonts.js"></script>

Check the browser’s Network and Console panels:

  1. Reload with the network panel open and make sure both files return successfully, rather than a 404, HTML error page, or a blocked response.
  2. Check that the files come from the pdfmake version your application installed.
  3. Check that window.pdfMake exists before your click handler runs.
  4. Look for JavaScript exceptions before the call to createPdf(); an earlier exception can leave an empty or stale definition.

The client-side guide lists these files and explains the browser setup: pdfmake client-side documentation. A script that loads but is incompatible with the other file can be just as troublesome as a missing script, so do not mix a CDN build from one release with a locally installed font bundle from another.

3. Check fonts and the virtual file system

vfs_fonts.js contains the default Roboto font definition. The project’s VFS guide states that “pdfmake uses ‘Roboto’ as default font, so in order to use your font, you should specify it in your doc-definition object.” A custom family must be present in the VFS, registered under the family name, and referenced by that same name in the document definition.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the default font first

Remove a custom font setting temporarily and generate with Roboto. If that fixes the file, the problem is in custom-font packaging, registration, file names, or the selected family name—not in your content.

Validate a custom font

  • Confirm the generated VFS actually contains every font file you register (regular, bold, italics, and bold italics when used).
  • Confirm the family key in the registration exactly matches the font value in the document definition.
  • Confirm the file names in the registration exactly match the names embedded in the VFS.
  • Regenerate the VFS after changing font files.

The official instructions are at custom fonts and VFS. They also warn that a custom VFS kept under node_modules can be replaced during installation or hidden by framework caching. Store an application-owned VFS outside that location and clear the relevant build cache when an old bundle keeps appearing.

4. Match output code to your installed pdfmake version

pdfmake’s browser API differs between documented releases. The 0.1 methods guide shows callback-style methods such as getBlob and getBuffer, while 0.3 documentation uses promise-returning methods such as getBlob(). Verify the package version in your lockfile or package.json, then follow that version’s documentation instead of combining examples.

Callback-style example (0.1 documentation)

pdfMake.createPdf(docDefinition).getBlob(function (blob) {
  const url = URL.createObjectURL(blob);
  window.open(url, '_blank');
});

Promise-style example (0.3 documentation)

const blob = await pdfMake.createPdf(docDefinition).getBlob();
const url = URL.createObjectURL(blob);
window.open(url, '_blank');

Use the documented download(), open(), print(), getBlob(), or getBuffer() method for your version. The relevant references are 0.1 browser methods and 0.3 browser methods.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Separate generation from display

First obtain a Blob or buffer and inspect its size. A non-empty Blob shows that generation completed; a viewer or popup issue is then a separate problem. In older asynchronous browser flows, the documented pattern opens a window before the callback and passes that window to open. This can avoid popup blockers and distinguish window handling from empty content:

const win = window.open('', '_blank');
pdfMake.createPdf(docDefinition).open({}, win);

If the browser blocks the new window, use a user-initiated button click, allow popups for the site, or download the Blob instead.

5. Isolate blank pages caused by layout rules

A file with content on some pages but an unexpected empty page is a different symptom from a definition with no content. Start with a plain paragraph, then reintroduce tables, headers, row-breaking rules, and explicit page breaks individually.

Check the documented interaction

The project changelog records a fix for an extra blank page involving headerRows, dontBreakRows, and a cell-level pageBreak. If your symptom matches that combination:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Remove the cell’s pageBreak and regenerate.
  2. Restore it without dontBreakRows.
  3. Restore dontBreakRows without repeated header rows.
  4. Check whether your installed version includes the changelog fix before upgrading or changing production layout.

This is a specific extra-page interaction, not a universal explanation for every blank PDF. See the official changelog for version details.

A practical diagnosis checklist

  • Completely blank file: test the minimal definition, then inspect the actual content value.
  • Console says pdfMake is undefined: fix script paths, load order, or bundler imports.
  • Custom-font version is blank or fails: switch to Roboto, then rebuild and register the VFS correctly.
  • Generation works but nothing opens: obtain a Blob, inspect its size, and check popup handling.
  • Only one page is empty: remove page-break and row-layout options one at a time.
  • After an upgrade: compare your code with the documentation for that exact major/minor version.

Or skip the browser setup

If your goal is a dependable image or PDF capture of a web page rather than debugging a pdfmake document, ScreenshotNeo provides a single HTTP request and an MCP server for AI clients. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.

For a direct capture, see the ScreenshotNeo API documentation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also supports PDF output, full-page and element captures, device and retina settings, custom CSS and JavaScript, waits, request blocking, cookies and headers, geolocation, caching, signed links, asynchronous webhooks, bulk calls, and an MCP server with take_screenshot, get_page_info, and capture_pdf. Every feature is on every plan. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up free.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

FAQ

Can a blank PDF be caused by the PDF viewer?

Yes. Retrieve a Blob or buffer and inspect it independently; if it has content, test another viewer or download route.

Should I upgrade pdfmake immediately?

Not necessarily. First identify your installed version and reproduce with a minimal definition. Upgrade only after checking compatibility and the changelog entry relevant to your layout.

Why does only my custom-font document fail?

That symptom points toward VFS contents, registration names, file paths, or stale framework caches. Re-test with the default Roboto setup to confirm.

Frequently Asked Questions

Can malformed table data make every page appear blank?

Yes. Replace the table temporarily with a paragraph, then validate that your rows and cell arrays contain the expected values before restoring the table.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What should I record before asking for help?

Record the pdfmake version, browser and build method, the exact document definition reduced to a minimal reproduction, console errors, script URLs, font setup, and whether a Blob or buffer has non-zero size.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.