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 errorsDirect fix: treat the first-page header, footer, CSS @page rules, and Puppeteer’s PDF margin option as one system. page.pdf() renders with print CSS, while displayHeaderFooter is a single document-wide switch; Puppeteer does not provide a per-page footer-template toggle. First record your Puppeteer and Chromium versions, then reproduce the PDF with minimal CSS and change one margin or page-rule variable at a time.
Why the footer moves or disappears
Puppeteer exposes displayHeaderFooter, headerTemplate, and footerTemplate in its PDF options. The display switch applies to the PDF as a whole, not to an individual page. Templates can contain the special classes date, title, url, pageNumber, and totalPages. See the PDFOptions reference.
The PDF method uses the print media type by default. If your layout was designed for screen media, call page.emulateMediaType('screen') before generating the PDF; otherwise inspect the print rules that Chromium is actually applying. The Page.pdf() documentation also notes that print output can alter colors unless you use -webkit-print-color-adjust.
Two independent margin systems commonly collide:
- CSS
@pageand@page:firstrules. - The
marginobject passed topage.pdf().
When both are present, a first-page rule that removes margins can interact unexpectedly with the PDF margins reserved for Puppeteer’s header and footer. The result may be a missing first-page header, a footer outside the printable area, or a footer that appears only on a later page.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#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
Start with a versioned reproduction
- Record the installed Puppeteer version, the Chromium executable and version it launches, and the operating system. A historical report used Puppeteer 1.3.0, Ubuntu 14.04, and Node.js 7.6.0; those versions are not evidence of current behavior, but they show why environment details matter.
- Save the exact HTML, CSS, PDF options, and generated PDF that demonstrate the fault.
- Confirm that
displayHeaderFooter: trueis set and that the templates contain only the elements you intend to test. - Generate a short document that is guaranteed to span several pages. Remove application styles, JavaScript, images, and fonts until the header and footer behavior is isolated.
A minimal Puppeteer test
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(`
<!doctype html>
<style>
@page { margin: 24mm 16mm; }
body { font: 12pt Arial, sans-serif; }
.break { break-after: page; }
</style>
<h1>Page one</h1>
<p>Replace this with enough text to create multiple pages.</p>
<div class="break"></div>
<h1>Page two</h1>
<p>More test content.</p>
`, { waitUntil: 'load' });
await page.pdf({
path: 'debug.pdf',
format: 'A4',
displayHeaderFooter: true,
headerTemplate: '<div style="font-size:8px;width:100%;text-align:center;">Header <span class="pageNumber"></span></div>',
footerTemplate: '<div style="font-size:8px;width:100%;text-align:center;">Footer <span class="pageNumber"></span>/<span class="totalPages"></span></div>',
margin: { top: '22mm', bottom: '18mm', left: '16mm', right: '16mm' },
printBackground: true,
preferCSSPageSize: false
});
await browser.close();
})();
Run this unchanged first. If both templates appear on every page, add your @page:first rule, then your production margins, then other layout rules one at a time. Keep the PDF after each change so you can identify the exact transition.
Check CSS page rules against PDF margins
Inspect @page:first
Look for declarations such as @page:first { margin: 0; }. Do not assume that this CSS margin replaces, rather than combines with, the margins supplied to page.pdf(). Test a version with no @page:first rule, then a version where only one side changes. A zero first-page margin can leave the header or footer template with no usable reserved area.
Check preferCSSPageSize
preferCSSPageSize defaults to false. When it is true, CSS @page size takes priority over format, width, or height. With the default, a CSS page size is scaled to fit the selected paper size. Set this deliberately and record the result; changing it can alter pagination and therefore where a footer is painted.
Check format, width, and height
format defaults to Letter and, when specified, takes priority over width and height. Use one sizing strategy in your reproduction. Mixing a CSS size, format: 'A4', and explicit dimensions makes it harder to tell whether the footer moved because of page geometry or template behavior.
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⁴
Control print versus screen media
Because page.pdf() selects print media, rules inside @media print and print-specific page styles can change element heights, visibility, and breaks. If the intended output should match screen CSS, run:
await page.emulateMediaType('screen');
await page.pdf({ path: 'screen-style.pdf', displayHeaderFooter: true });
Otherwise leave the default print media in place and debug the print stylesheet directly. Comparing a screenshot taken under screen media with a PDF rendered under print media is not a valid diagnosis of footer placement.
A disciplined troubleshooting matrix
| Symptom | What to inspect | Next experiment |
|---|---|---|
| Header missing only on page one | @page:first, first-page display rules, and top PDF margin |
Remove @page:first; keep the same PDF margin and regenerate |
| Footer appears only on the last page | Bottom margin, page breaks, and the footer template’s height | Use a simple one-line footer and a fixed bottom margin on every page |
| Footer is clipped or overlaps content | PDF bottom margin versus template height | Increase the bottom margin and remove bottom-positioning CSS from the template |
| Pagination changes when CSS size is added | preferCSSPageSize, format, and @page size |
Run once with preferCSSPageSize: false and once with true |
| Only production fails | Chromium revision, Puppeteer version, OS, fonts, and loaded assets | Run the minimal document in the production container and compare PDFs |
Use a stable layout strategy
Strategy A: reserve one margin system
The simplest baseline is to use a uniform CSS @page margin and the same four-sided values in Puppeteer’s margin option, avoiding @page:first until the baseline works. This makes the printable area predictable and gives the templates room on every page.
Strategy B: put first-page content in the document
If the first page must have a different visual header, keep Puppeteer’s header/footer enabled consistently and place the special first-page heading in the HTML body. CSS can hide that body element on later pages only when your pagination rules are reliable. This avoids expecting a document-wide template API to make a per-page decision it does not expose.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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.
Strategy C: separate files when geometry truly differs
For documents whose first page requires fundamentally different margins, generate separate PDFs (for example, a cover and a body) and merge them with a PDF tool. This is more work, but it removes ambiguity about whether one page rule and one global template can satisfy incompatible geometries.
Validate the output, not just the DOM
- Open every page of the generated PDF and verify the header and footer positions.
- Check that body text does not enter the reserved header or footer area.
- Test a document with one page, exactly two pages, and several pages; last-page-only symptoms can be hidden in a one-page test.
- Repeat with production fonts and assets. Font fallback can change line wrapping and push a footer to a different page.
- Change one variable per run and keep the PDFs plus option objects as artifacts for comparison.
Historical clue, not a universal fix
Puppeteer issue #2480, opened April 30, 2018, describes @page:first margins set to zero, PDF top and bottom margins of 50px, and a symptom in which the first-page header was absent while the footer appeared only on the last page. The issue was labeled an unconfirmed upstream Chromium issue and used Puppeteer 1.3.0, Ubuntu 14.04, and Node.js 7.6.0. It is a useful reproduction clue, not proof of a defect or workaround in current releases. Test the exact versions you deploy before adopting any adjustment.
Or skip the browser setup
For a clean website capture rather than a custom Puppeteer PDF pipeline, ScreenshotNeo accepts one GET request and returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie/consent banners 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 status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
cURL (see the ScreenshotNeo API docs):
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}`);
The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is included on every plan. Create a free ScreenshotNeo account.
FAQ
Can I hide Puppeteer’s header on only page one?
Not through a documented per-page template switch. Use document content for page-specific visuals, split documents, or redesign the page geometry.
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
Should I use CSS margins or the PDF margin option?
Choose and document a primary strategy, then test the interaction explicitly. Mixing them is possible, but first-page rules make the effective printable area easy to misread.
Does changing preferCSSPageSize fix the footer?
It can change page geometry and pagination, but the documentation does not promise it as a footer fix. Compare both settings in your minimal reproduction.
Frequently Asked Questions
Which Puppeteer option enables headers and footers?
Set displayHeaderFooter: true; provide the HTML through headerTemplate and footerTemplate.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →What media type does page.pdf() use?
Print media by default. Call page.emulateMediaType('screen') first when screen CSS is required.
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.

