Recommended Free Tools
iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
To add headers and footers to a webpage PDF with Puppeteer, set displayHeaderFooter: true in page.pdf(), then provide HTML in headerTemplate, footerTemplate, or both. Reserve room for them with the PDF’s top and bottom margins; otherwise, the running content can overlap the document.
Working Puppeteer example
The following CommonJS example opens a webpage and saves an A4 PDF with the document title in the header and page numbers in the footer. It uses documented Puppeteer PDF options; inspect the resulting PDF in your own runtime because rendering can vary by Chromium version and operating system.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle0' });
await page.pdf({
path: 'page.pdf',
format: 'A4',
displayHeaderFooter: true,
headerTemplate: `
<div style="font-size: 9px; width: 100%; text-align: center;">
<span class="title"></span>
</div>`,
footerTemplate: `
<div style="font-size: 9px; width: 100%; text-align: center;">
<span class="pageNumber"></span> / <span class="totalPages"></span>
</div>`,
margin: {
top: '0.7in',
bottom: '0.7in',
left: '0.5in',
right: '0.5in',
},
});
} finally {
await browser.close();
}
})();
Replace https://example.com with the page to capture. The title, pageNumber, and totalPages class names are special Puppeteer template classes. For other documented template fields and options, see the Puppeteer PDFOptions API and the PDF generation guide.
Configure the running header and footer
Enable and place the templates
displayHeaderFooter defaults to false; turn it on to display configured templates. Put content at the top in headerTemplate, at the bottom in footerTemplate, or define both. Each property accepts an HTML string. Keep the markup simple and check the printed result.
#1 Best Overall
- PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
- QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
- VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
- INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
- EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
Use the built-in template values
Put a span with the matching class in a template to insert a built-in value:
datefor the print datetitlefor the document titleurlfor the document URLpageNumberfor the current page numbertotalPagesfor the total page count
Class spelling and capitalization matter. Use pageNumber and totalPages as shown rather than trying to calculate pagination in application code.
Rank #2
- FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
- READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
- WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
- OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
Leave enough margin for the templates
Margins are undefined by default, which means no margins are set. Set the top and bottom margins large enough for the header and footer, respectively, and adjust them to match your design. The example uses 0.7 inches at the top and bottom and 0.5 inches on each side; these are starting values, not universal requirements. If the running content collides with the page, increase the corresponding margin.
Choose PDF page size and print behavior
page.pdf() generates the document using print CSS. Check @media print and @page rules if the PDF layout differs from the screen. If you want screen styles instead, call await page.emulateMediaType('screen') before page.pdf().
Rank #3
- STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
- CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
- HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
- FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
- BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer
The PDF options also let you control geometry and rendering with format, width, height, landscape, margin, scale, and preferCSSPageSize. The documented default format is Letter. When format is set, it takes priority over width and height; preferCSSPageSize controls whether CSS @page sizing takes priority. Select one paper-size approach deliberately if your document depends on exact page dimensions.
Puppeteer’s PDF guide says page.pdf() waits for fonts by default. For print colors, Puppeteer applies print-oriented color adjustments by default; see the Page API for the documented -webkit-print-color-adjust behavior.
Rank #4
- IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
- IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
- IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
- Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management
Troubleshoot missing or misaligned headers and footers
- Nothing appears: Confirm that
displayHeaderFooteristrueand that the relevant template property contains HTML. - Header or footer overlaps page content: Increase the top or bottom margin to create space for it. Margins are not set by default.
- Page numbers or metadata are blank: Check the exact documented class name in the template, including capitalization:
pageNumber,totalPages,title,date, orurl. - PDF layout differs from the browser: PDF generation uses print media by default. Review print-specific CSS and
@pagesizing, or emulate screen media before generating the PDF if that is the intended output. - Fonts or colors look different: The PDF guide says fonts are awaited by default. Review print color-adjust rules and
-webkit-print-color-adjustwhen colors need to match more closely.
Or skip the browser setup
If you only need an image or PDF capture from a URL, ScreenshotNeo provides a screenshot API and MCP server. For example, save a webpage as a PDF with one GET request:
Quick Recap
Best Value
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com
-d format=pdf
-o page.pdf
See the ScreenshotNeo documentation for API options. It removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000. Sign up for a free account.
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.

