Free tools Windows power users keep installed
One-click scans. No signup required.
Use htmlToPdf.generatePdfs(files, options). Pass an array in which each item contains either a public url or an HTML content string, then save the returned PDF buffers yourself. The same options object applies to every document in that batch.
This guide shows a complete Node.js implementation, explains paper and pagination settings, and covers failures you are likely to meet when rendering several documents.
Install html-pdf-node and prepare the output directory
Create a Node.js project (Node.js 14 or newer is a practical baseline for current Puppeteer dependencies), then install the package:
npm init -y
npm install html-pdf-node
The package launches a Chromium-based renderer. Your deployment therefore needs a compatible browser binary and permission to start it. In restricted Linux containers, the documented Chromium arguments include --no-sandbox and --disable-setuid-sandbox; review the security implications before using them in production. The package README is the authoritative reference for the current behavior: html-pdf-node on GitHub.
#1 Best Overall
- INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
- COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
- ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
- HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
Make an output directory before writing files:
mkdir -p out
On Windows, create an out folder beside your script instead.
Batch example: HTML strings and URLs in one call
Save this as generate-pdfs.js. It uses stable names to associate each returned buffer with its input, checks the result count, and writes files concurrently:
const htmlToPdf = require('html-pdf-node');
const fs = require('node:fs/promises');
const path = require('node:path');
const files = [
{
content: `<!doctype html>
<html><head><meta charset="utf-8"></head>
<body><h1>Invoice 1001</h1><p>Alice</p></body></html>`,
name: 'invoice-1001.pdf'
},
{
content: '<h1>Invoice 1002</h1><p>Bob</p>',
name: 'invoice-1002.pdf'
},
{
url: 'https://example.com/report',
name: 'report.pdf'
}
];
const options = {
format: 'A4',
printBackground: true,
margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
path: false
};
async function run() {
await fs.mkdir('./out', { recursive: true });
const results = await htmlToPdf.generatePdfs(files, options);
if (!Array.isArray(results) || results.length !== files.length) {
throw new Error(`Expected ${files.length} PDFs, received ${results.length}`);
}
await Promise.all(results.map(async ({ name, buffer }, index) => {
if (!Buffer.isBuffer(buffer)) {
throw new TypeError(`Result ${index} did not contain a PDF buffer`);
}
const safeName = path.basename(name || `document-${index + 1}.pdf`);
await fs.writeFile(path.join('./out', safeName), buffer);
}));
}
run().catch(error => {
console.error(error);
process.exitCode = 1;
});
Run it with node generate-pdfs.js. The promise returned by generatePdfs resolves to an array of objects containing PDF buffers. The name property is useful application metadata; choose and validate your own filenames rather than trusting names supplied by users.
How the input array works
content: an HTML string rendered directly by Chromium.url: a publicly reachable page that the renderer can load.name: an identifier you can use when persisting the matching buffer. The README examples include it, but your code remains responsible for naming and storage.
Build or sanitize each HTML document before calling the API. If a URL requires authentication, a private network route, or client-side data that appears only after an interaction, the package README does not define a universal wait or timeout contract; test that page in your own environment and consider generating a self-contained content string instead.
Set paper size, margins, orientation, and pagination
All entries in one generatePdfs call share the options object. Use these controls to make every output consistent:
| Option | Purpose and behavior | Example |
|---|---|---|
format |
Named paper format. The documented default is Letter; set A4 explicitly when that is your target. | format: 'A4' |
width, height |
Custom paper dimensions with units. A set format takes priority over these dimensions. |
width: '210mm', height: '297mm' |
margin |
Independent top, right, bottom, and left margins. Include units such as mm, cm, in, or px. |
{ top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' } |
pageRanges |
Print selected pages, for example 1-5, 8, 11-13. An empty value prints all pages. |
pageRanges: '1-3, 7' |
preferCSSPageSize |
When true, CSS @page size takes priority over format, width, and height. |
preferCSSPageSize: true |
printBackground |
Print background graphics and colors. The documented default is false. | printBackground: true |
landscape |
Use landscape orientation. The documented default is false. | landscape: true |
args |
Additional Chromium command-line flags. The README documents --no-sandbox and --disable-setuid-sandbox as defaults. |
args: ['--no-sandbox'] |
path |
Path option for direct output. For per-file names, validation, and individual error handling, leave it false and write returned buffers. | path: false |
Use CSS page rules deliberately
For a document that must control its own paper size, put the rule in the HTML and enable CSS precedence:
Rank #2
- CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
- INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
- PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
- ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
<style>
@page { size: A4 portrait; margin: 12mm; }
@media print {
.page-break { break-before: page; }
.avoid-split { break-inside: avoid; }
}
</style>
If preferCSSPageSize is false (the default), the JavaScript paper settings can override this rule. Do not set conflicting format, custom dimensions, and CSS sizes unless you have verified which one should win.
Different settings for different PDFs
generatePdfs applies one options object to the entire array. If invoices need A4 and a landscape dashboard needs Letter, group the documents into separate calls (or normalize the HTML to one shared layout), then persist each result set independently.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Reliable batch processing in an application
Keep input order and names explicit
Store an application record such as { id, name, content }, construct the package array from it, and map results back by index. Reject path traversal characters by taking path.basename or, safer, generating names from an internal ID. Never let an uploaded filename decide an arbitrary filesystem path.
Validate completion and writes
Check that the result is an array, that its length equals the input count, and that every item contains a non-empty buffer. Write to a temporary directory and rename files after successful writes when readers must never see partial files. If one write fails, record the input ID and remove any files already created for that batch if your operation is intended to be atomic.
Control workload and capacity
The package documentation publishes no throughput or concurrency benchmark. Measure your own HTML size, image mix, URL latency, CPU, memory, and container limits. Large batches can consume substantial memory because buffers remain available until written and released. For high volume, process bounded chunks, write each chunk before creating the next, and monitor Chromium process count. Do not assume that one very large array is faster than several smaller calls.
URLs versus inline HTML
URL entries depend on DNS, TLS, routing, remote JavaScript, fonts, images, and the target site’s response time. A URL that works in your browser may fail from a server without outbound access. Inline HTML removes that network dependency, but referenced assets still need reachable URLs unless you embed them (for example, as data URLs). The README documents URL input but does not publish a wait strategy or timeout guarantee, so pages that render asynchronously require environment-specific testing.
Recommended Free Tools
Rank #3
- SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
- INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
- KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster
- THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
Troubleshooting common failures
The process cannot launch Chromium
Symptoms: an executable-not-found error, sandbox failure, or immediate browser disconnect. Confirm that the package’s browser dependency was installed and that the runtime user can execute it. In a locked-down Linux container, review the documented sandbox flags and your security policy rather than copying them blindly. Ensure shared memory and process limits are sufficient.
A URL produces a blank or incomplete PDF
Verify the URL from the same host, including DNS, certificates, authentication, and firewall rules. Check that the content is not inserted only after an interaction or delayed network request. Prefer pre-rendered HTML for deterministic jobs; otherwise adjust the page itself so required content exists at initial load and test repeatedly under production network conditions.
Background colors or images are missing
Set printBackground: true. Also verify that assets load before capture and that your CSS does not hide them in print media. A remote image or font that is blocked, cross-origin restricted, or still loading cannot be recovered by the PDF option alone.
Paper size or margins look wrong
Look for conflicting settings. A named format wins over width/height; preferCSSPageSize: true gives @page precedence. Confirm units on every margin and remove stale CSS page rules when JavaScript should be authoritative.
Only some files are saved
Log the input index, name, and error for each write. Confirm that the output directory exists and that the process user has permission. Keep the result-count check: a mismatch means the rendering operation did not produce the set your application expected, so do not silently continue.
The job is too slow or runs out of memory
Reduce concurrency, split the input into bounded batches, optimize oversized images, and write buffers promptly. Measure before selecting limits; no published html-pdf-node benchmark establishes a safe universal batch size.
Rank #4
- Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
- No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
- Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
- Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
- The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
Or skip the browser setup
If you only need screenshots or PDFs from web pages and do not want to maintain Chromium in your Node process, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF output. For a PDF-oriented call, consult the ScreenshotNeo API documentation and adapt the target URL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie-consent banners, newsletter popups, and chat widgets before capture; failed bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →When html-pdf-node is the better fit
- Choose html-pdf-node when your Node application already owns the HTML, needs returned buffers, or must apply one controlled Chromium configuration to a batch.
- Choose a hosted API when you prefer not to operate a browser runtime, need an MCP workflow, or want billing signals for failed captures.
- For either approach, establish your own latency, memory, rendering-fidelity, and concurrency measurements before setting production limits.
Package status and maintenance check
The npm page currently displays version 1.0.8 and 44,456 weekly downloads, with a publication age shown as five years; those values can change, so verify them on npm before adopting or upgrading. The repository documentation remains the source for the batch signature and option names.
Frequently Asked Questions
Does generatePdfs create files automatically?
It returns an array of objects containing PDF buffers. Your application decides whether to write those buffers, stream them, upload them, or discard them.
Can one batch contain both URLs and HTML strings?
Yes. Each array entry can independently use a public url or an HTML content string, so the two input types can be mixed in one call.
Can each document have a different page range?
Not within one call, because pageRanges is part of the shared options object. Run separate calls for documents requiring different rendering settings.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC 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 & 11Where are wait and timeout settings documented?
The package README documents URL input but does not publish a general wait strategy or timeout contract. Pages with delayed rendering should be made deterministic or validated in your deployment environment.
Quick 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.

