Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
A blank pdfmake file usually comes from one of four layers: an empty or wrong document-definition object, missing browser scripts or fonts, an API mismatch between pdfmake versions, or a layout rule that creates an empty page. Check those layers in that order. Start with a minimal document, verify the loaded assets and font VFS, then test the output method before reintroducing tables, page breaks, and custom fonts.
1. Prove that the document definition contains content
pdfmake is declarative: the object passed to pdfMake.createPdf() tells the library what to lay out. If that object is undefined, comes from stale state, or has an empty content array, pdfmake can produce a valid-looking PDF with no visible content. The project’s minimal example is:
const docDefinition = {
content: 'This is an sample PDF printed with pdfMake'
};
pdfMake.createPdf(docDefinition).download('example.pdf');
Compare your application with the official repository example at github.com/bpampuch/pdfmake. Log the exact object immediately before generation, not the data source several functions earlier.
console.log('docDefinition:', JSON.stringify(docDefinition, null, 2));
if (!docDefinition || !Array.isArray(docDefinition.content) && typeof docDefinition.content !== 'string') {
throw new Error('docDefinition.content is missing or has an unexpected type');
}
pdfMake.createPdf(docDefinition).download('debug.pdf');
Check the common content mistakes
- Wrong variable: you build
documentDefinitionbut passdocDefinition, or pass an older object retained in component state. - Empty array: a loop that should create rows returns
[]; test the array length before assigning it tocontent. - Conditional omission: code such as
content: data ? makeContent(data) : []silently creates an empty document when data has not loaded. - Invalid nesting: put text, stacks, columns, tables, images, and other supported nodes inside
content; do not place application objects there and expect pdfmake to infer their fields.
Replace your real definition temporarily with the one-line example. If that file is still blank, the problem is outside your business data and you should continue with the browser setup checks.
#1 Best Overall
2. Verify the browser scripts and their load order
The official client-side setup for the 0.1 documentation loads both the pdfmake browser bundle and the virtual file-system (VFS) font bundle: pdfmake.min.js followed by vfs_fonts.js. The VFS bundle contains the default Roboto font definition. Follow the exact setup documented at pdfmake’s client-side guide.
<script src="/path/to/pdfmake.min.js"></script>
<script src="/path/to/vfs_fonts.js"></script>
<script>
const docDefinition = { content: 'Asset smoke test' };
pdfMake.createPdf(docDefinition).download('asset-test.pdf');
</script>
Open browser developer tools and check:
- The Network panel returns successful responses for both files (not a 404, HTML error page, or an old cached bundle).
- The Console has no script parse error before your generation code runs.
window.pdfMakeexists andpdfMake.vfsis populated after the VFS script loads.- The two files come from the same installed pdfmake version. Mixing a current core file with an old VFS file can create failures that look like content problems.
If you use a bundler, inspect the generated browser chunk rather than assuming that an npm import produced the global shown in a script-tag example. Keep one integration style: either the documented global scripts or the module API for your package version.
3. Confirm fonts and VFS registration
pdfmake uses Roboto by default. The project’s VFS documentation states that custom fonts must be generated or supplied in the VFS, registered under a family name, and referenced by that same family in the document definition. Read the complete procedure at the VFS and custom-font guide.
Recommended Free Tools
Use the default font as a control test
Remove any custom font property and generate a short paragraph. If Roboto renders, your layout is working and the custom-font path is the fault domain.
const docDefinition = {
defaultStyle: { font: 'Roboto' },
content: [{ text: 'Roboto control test', fontSize: 16 }]
};
pdfMake.createPdf(docDefinition).download('roboto-test.pdf');
Register a custom family consistently
The family name in pdfMake.fonts must point to file names that actually exist in pdfMake.vfs. A mismatch in capitalization, extension, or path leaves pdfmake unable to resolve the face.
pdfMake.fonts = {
Inter: {
normal: 'Inter-Regular.ttf',
bold: 'Inter-Bold.ttf',
italics: 'Inter-Italic.ttf',
bolditalics: 'Inter-BoldItalic.ttf'
}
};
const docDefinition = {
defaultStyle: { font: 'Inter' },
content: 'Custom-font test'
};
Inspect the keys before creating the PDF:
console.log(Object.keys(pdfMake.vfs || {}));
console.log(pdfMake.fonts);
If you generated a custom VFS inside node_modules, remember that an install can replace it and framework caches can obscure updates. Store the generated VFS in an app-owned location, update the import, and clear the relevant build cache when the browser continues serving old font data. Rebuild after changing the VFS; editing a source file does not guarantee that an already emitted bundle changed.
4. Match the output API to your installed pdfmake version
Do not copy a callback example into a promise-based installation, or vice versa. The 0.1 methods documentation shows callback-style methods such as getBlob and getBuffer at the 0.1 output-method guide. The 0.3 documentation describes promise-based methods such as getBlob() at the 0.3 methods guide.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Callback-style example (0.1 documentation)
const docDefinition = { content: 'Callback output' };
pdfMake.createPdf(docDefinition).getBlob(function (blob) {
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'callback.pdf';
link.click();
URL.revokeObjectURL(url);
});
Promise-style example (0.3 documentation)
const docDefinition = { content: 'Promise output' };
const blob = await pdfMake.createPdf(docDefinition).getBlob();
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'promise.pdf';
link.click();
URL.revokeObjectURL(url);
Check the version recorded in your lockfile or package manifest, then use that version’s documentation. An API mismatch is a compatibility warning, not proof that every blank file has the same cause.
Rank #3
5. Separate generation from display and download
A PDF can be generated correctly while the browser fails to display it: popup blocking, an invalid object URL, or code that revokes the URL before the viewer reads it can make a good blob appear empty. First save a blob and inspect its size and MIME type.
function inspectBlob(blob) {
console.log({ size: blob.size, type: blob.type });
if (!blob.size) throw new Error('Generated blob is empty');
}
pdfMake.createPdf({ content: 'Blob inspection' }).getBlob(function (blob) {
inspectBlob(blob);
const url = URL.createObjectURL(blob);
window.open(url, '_blank', 'noopener');
});
For asynchronous browser flows, the 0.1 methods guide demonstrates opening a window before the asynchronous response and passing that window to open. This avoids confusing popup policy with PDF generation. If the blob has a nonzero size and downloads correctly but a new tab is blank, test another PDF viewer and the browser’s popup permissions.
6. Isolate blank pages caused by layout rules
When only one page is empty, or an unexpected extra page appears, simplify the layout instead of treating it as a completely blank-document failure. Remove tables, headers, footers, images, and explicit page breaks one at a time. Then add them back in a minimal reproduction.
Check the documented table/page-break interaction
The project changelog records a fix for an extra blank page involving headerRows, dontBreakRows, and a cell-level pageBreak. This is a specific interaction, not a universal explanation for blank PDFs. Review the changelog at github.com/bpampuch/pdfmake/blob/master/CHANGELOG.md and verify whether your installed version contains the fix.
Rank #4
const docDefinition = {
content: [{
table: {
headerRows: 1,
dontBreakRows: true,
widths: ['*', '*'],
body: [
['Name', 'Status'],
['Example', 'OK']
]
}
}]
};
For diagnosis, remove headerRows, then dontBreakRows, then the cell’s pageBreak setting, generating a new file after each change. If one change removes the empty page, keep the smallest reproduction and update pdfmake before restoring the feature.
7. A repeatable diagnostic workflow
- Record the environment: pdfmake version, browser, bundler, script URLs, and whether you use callbacks or promises.
- Generate plain text: use
{ content: 'smoke test' }. This separates data and layout from installation. - Check assets: confirm
pdfmake.min.jsandvfs_fonts.jsload successfully and match versions. - Use Roboto: remove custom fonts; inspect
pdfMake.vfsif text remains absent. - Inspect the blob: log size and type before opening or downloading.
- Reintroduce content incrementally: add your data, styles, images, tables, and page-break options separately.
- Retest after dependency changes: clear framework caches and rebuild so an old VFS or core bundle is not being served.
8. Common symptoms, causes, and fixes
| Symptom | Likely layer | Fix |
|---|---|---|
| Minimal text document is blank | Core script, VFS load, or output API | Verify both browser files, version pairing, and the correct callback/promise method. |
| Text disappears only after selecting a custom font | VFS registration | Return to Roboto, inspect VFS keys, and match family names to embedded file names. |
| Downloaded file has bytes but a new tab is empty | Display or popup handling | Open the window before the async callback, test the object URL, and check popup permissions. |
| Only an extra page is empty | Pagination rules | Isolate headerRows, dontBreakRows, and cell pageBreak; check the changelog fix. |
| Works after a clean install but fails in the app | Cache or generated VFS | Move custom VFS out of node_modules, clear build caches, and confirm the emitted files. |
Or skip the browser setup
If your goal is a clean image or PDF of a web page rather than a pdfmake document, ScreenshotNeo provides a single HTTP request and an MCP server for AI agents. It accepts cookie and consent banners before capture, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and lets you turn each step off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and billing status.
For a screenshot, use the API example from the ScreenshotNeo documentation:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in 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)
And 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 capture, full-page and element shots, device presets, custom viewports, retina scale, JavaScript and CSS, waits, request blocking, headers, cookies, geolocation, caching, signed links, asynchronous webhooks, bulk capture, and an MCP server with take_screenshot, get_page_info, and capture_pdf. Every feature is on every plan: 1,000 screenshots per month are free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
9. Reliability and cost considerations
- Keep a tiny smoke-test definition in automated checks so a dependency upgrade reveals missing assets or API changes immediately.
- Pin pdfmake and its VFS generation step together; update them deliberately rather than allowing only one bundle to change.
- Save a failing document definition and the browser console error when reporting a bug. A minimal reproduction makes layout interactions distinguishable from setup errors.
- Generate once and inspect the resulting blob before opening multiple viewers. This avoids mistaking a display failure for a rendering failure.
FAQ
Can a PDF reader cause a blank pdfmake file?
It can hide a valid output, but first inspect the generated blob’s size and MIME type and try a download. A zero-byte blob points to generation; a normal blob that fails only in one viewer points to display or viewer handling.
Best Value
Should I switch to a different font to fix the issue?
Use Roboto as a control test. Switching fonts without checking VFS keys and registration can conceal the configuration error rather than fix it.
Does every blank page mean pdfmake is broken?
No. An empty document, missing assets, API mismatch, display handling, and pagination rules have different symptoms. The documented changelog issue concerns a particular table and page-break combination.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Which pdfmake documentation should I follow?
Use the guide matching the version in your lockfile. The 0.1 pages show callback methods, while 0.3 pages show promise-based methods, so combining snippets can create an integration mismatch.
Frequently Asked Questions
How can I tell whether the PDF is empty or only displayed incorrectly?
Inspect the Blob size and MIME type before opening it, then download the file. A nonzero Blob that downloads normally indicates a browser-window or viewer problem rather than empty pdfmake content.
What is the fastest first test?
Generate { content: 'smoke test' } with the default Roboto font. If that fails, investigate scripts, VFS loading, and the installed-version API before your application data.
Where should a custom VFS file live?
Keep generated VFS assets in an app-owned location instead of node_modules, because installs can replace files there and framework caches can serve stale content.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsQuick Recap
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.

