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

If a Playwright PDF footer is missing, tiny, misplaced, or styled with the wrong font, first check the PDF options and the template itself—not just the parser. Set displayHeaderFooter: true, use valid HTML and Playwright’s documented placeholder classes, put essential styling inside the template, and reserve enough bottom margin. Playwright documents that this option defaults to false, page styles do not reach header/footer templates, and scripts in templates do not run. Those facts account for several common surprises, but they do not prove that every footer problem has one cause.

Start with the footer option and a minimal template

Playwright’s page.pdf() does not show header or footer templates unless displayHeaderFooter is enabled; its documented default is false. Pass your footer as the footerTemplate option. When a header is also configured, temporarily test the footer alone so you can tell which template is failing.

Reduce the template to ordinary visible text first. If that renders, add the documented dynamic-value classes, then add styling and more complex markup in small increments. This separates an activation or HTML problem from a styling, layout, or environment problem.

const pdf = await page.pdf({
  format: 'Letter',
  displayHeaderFooter: true,
  footerTemplate: '<div style="width:100%; text-align:center; font-size:9px;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>',
  margin: {
    top: '0.5in',
    right: '0.5in',
    bottom: '0.6in',
    left: '0.5in'
  }
});

This is a diagnostic starting point, not a universal layout prescription. Adjust the margins and text size to your document, then inspect the resulting PDF. Playwright accepts px, in, cm, and mm units for dimensions and margins; an unlabeled numeric value is treated as pixels. The documented default paper format is Letter. See the Playwright Page API documentation for the options available in the version you use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
  • 1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing

Use valid template HTML and documented placeholders

Playwright describes header and footer templates as HTML markup. Begin with a simple element containing plain text; then add the pieces you need. For dynamic values, use the documented class names:

  • date for the date
  • title for the document title
  • url for the document URL
  • pageNumber for the current page number
  • totalPages for the total number of pages

For example, a footer can combine static text and page numbers using <span class="pageNumber"></span> and <span class="totalPages"></span>. If a value is blank or appears literally rather than being populated, check the spelling and capitalization of the class, and confirm the template is being supplied to the intended option.

Do not depend on template scripts to compute content: the API documentation explicitly says, “Script tags inside templates are not evaluated.” Generate any needed value outside the template and use a supported mechanism rather than expecting JavaScript inside the template to run.

Rank #2
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
  • HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America. Each ream is wrapped in a polyurethane coated paper wrapper to protect the cut sheets from moisture damage
  • Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
  • HP Copy&Print20 20 pounds printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design)
  • All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment; 100% satisfaction guaranteed; ColorLok technology provides more vivid colors, bolder blacks and faster drying
  • Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office; HP Copy&Print20 print and copy paper prevents yellowing over time to ensure a long-lasting appearance for added archival quality

Put essential CSS inside the footer template

A frequent source of “the footer template parsing is broken” reports is style scope. Playwright explicitly says that page styles are not visible inside header/footer templates. A stylesheet attached to the page therefore cannot be assumed to style the footer. Put essential presentation rules—such as font size, width, alignment, and color—directly in the template, for example with inline styles on its elements.

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

Keep the first styled version modest and easy to inspect. If plain text works but the styled version does not, remove styling in stages until the change that triggers the problem is clear. Avoid relying on scripts, external page styles, or a complex template until the basic HTML is rendering correctly.

Give the footer room and check for overlap

A footer may render but be difficult to see because it is too close to the page edge, crowded by document content, or positioned in too little available space. Set an explicit bottom margin that can accommodate the footer’s intended height, then inspect multiple pages of the PDF for crowding or overlap. The PDF API exposes margin controls, and its documented default top margin is zero; the appropriate values depend on your content and layout.

Rank #3
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
  • 3 ream case (1,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing

Margins are a practical diagnostic, not a guaranteed explanation for every symptom. A historical report described header/footer content crowding after text was enlarged, but it does not establish a universal font size or a universal fix. Set a font size explicitly in the template and inspect the output at normal zoom. If enlarging text makes the footer collide with page content, revisit both the template dimensions and the bottom margin.

Separate print-media behavior from template styling

page.pdf() uses print CSS by default. If you need screen-media styling in the main page, emulate screen media before generating the PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.emulateMedia({ media: 'screen' });
await page.pdf({
  displayHeaderFooter: true,
  footerTemplate: '<div style="width:100%; text-align:center; font-size:9px;">Page <span class="pageNumber"></span></div>',
  margin: { bottom: '0.6in' }
});

This changes the media used to render the page; it does not make the page’s stylesheet available inside the footer template. Print colors are also modified by default. The documentation points to -webkit-print-color-adjust when exact print colors are needed. Treat media selection, print-color handling, and template CSS as separate controls rather than expecting one to fix the others.

Rank #4
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 5 Reams (2,500 Sheets), 92 Bright White
  • 5 ream case (2,500 sheets) of 8.5 x 11 white copier and printer paper for home or office use
  • Multipurpose letter size copy paper works with laser/inkjet printers, copiers and fax machines
  • Smooth 20lb weight paper for consistent ink and toner distribution; dries quickly and resists paper jams
  • Bright white paper (92 GE; 104 Euro) offers great contrast for crisp printing and vivid color
  • Virgin copy paper providing professional quality results; acid-free to prevent yellowing

Treat font failures as a separate diagnosis

If the footer appears but uses a fallback font, first confirm that the font is actually available in the environment generating the PDF. Keep any necessary font declaration with the template rather than assuming a page stylesheet will carry over. A fallback font is a useful way to make the output legible while diagnosing the intended font.

A Playwright issue opened in 2024 reports imported font-face styling not applying in a template, including after an attempt to use base64. That report does not establish a general cause or confirmed fix. Verify the result in your own runtime and avoid presenting the issue report as proof of a current, universal Playwright defect.

Is this a Playwright bug?

Not necessarily. Missing footers can result from the disabled-by-default option; invisible styling can result from page/template CSS scope; and tiny or overlapping content can be a layout issue. Historical GitHub reports show that users have encountered invisible templates, unusually small output, and font problems, but they do not establish a general current parser bug.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP Printer Paper | 8.5 x 11 Paper | Office 20 lb | 3 Ream Case - 1500 Sheets | 92 Bright | Made in USA - FSC Certified | 112090C, White
  • Made in USA: HP Papers is sourced from renewable forest resources and has achieved production with 0% deforestation in North America.
  • Optimized for HP technology: All HP Papers provide premium performance on HP equipment, as well as on all other printer and copier equipment.
  • Perfect everyday office paper: Superior quality, reliability, and dependability for high-volume printing at home, at school and in the office. Perfect for everyday black and white printing.
  • Certified sustainable: HP Office20 20lb printer paper is Forest Stewardship Council (FSC) certified and contributes toward satisfying credit MR1 under LEED (Leadership in Energy and Environmental Design).
  • ColorLok technology printing paper: ColorLok technology provides more vivid colors, bolder blacks and faster drying.

One invisible-template report specifically names Playwright 1.22.0, .NET 6, Windows 11, and Chromium. It is evidence of a report in that particular setup, not a description of every current Playwright installation. Before attributing a failure to Playwright itself, reproduce it with a minimal template and record the exact library version, language binding, operating system, browser engine, PDF options, and output.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A practical troubleshooting sequence

  1. Enable templates. Set displayHeaderFooter: true and confirm that footerTemplate is passed to the same page.pdf() call that creates the PDF.
  2. Isolate the footer. If a header is configured too, remove it temporarily. Test one template at a time.
  3. Use plain visible HTML. Start with a simple text element. Add supported placeholder classes only after that appears.
  4. Move styling into the template. Add essential CSS inline. Do not expect page styles to apply inside the template, and remove any template script because scripts there are not evaluated.
  5. Set and inspect margins. Add explicit space at the bottom, generate the PDF, and check for overlap or clipping across pages.
  6. Check media and color independently. Confirm whether print or screen CSS is intended. If exact print colors matter, follow the documented print-color guidance.
  7. Check the font in the generation environment. Verify availability, use a fallback while diagnosing, and avoid assuming an imported font is automatically available to the template.
  8. Capture a reproducible case. Note the Playwright version, language binding, OS, browser engine, exact PDF options, minimal template, and what the PDF actually shows.

Common symptoms, likely checks, and fixes

Symptom First checks Practical next step
Footer is absent displayHeaderFooter is enabled; footerTemplate is passed to page.pdf(); the template contains visible HTML. Test a plain-text footer with no header, placeholders, or styling.
Page number or total is blank Use the documented pageNumber and totalPages classes with the expected capitalization. Restore the placeholders in a template that already renders plain text.
Footer is unstyled Page styles are not visible inside templates; scripts in templates are not evaluated. Put essential CSS directly in the template and remove script-dependent behavior.
Footer is tiny or overlaps content Check explicit template font size, available bottom margin, and the PDF at normal zoom. Adjust template sizing and margin, then inspect more than the first page.
Expected print colors are missing page.pdf() uses print media by default and modifies print colors by default. Choose the intended media and consult the API’s print-color guidance separately.
Custom font is not used Page CSS does not reach the template; verify the font is available in the PDF-generation environment. Keep the declaration with the template and try a fallback while narrowing the issue.

Or skip the browser setup

If your goal is to capture a web page as an image or PDF rather than debug a custom Playwright template, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot flow accepts cookie/consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. An MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

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

See the ScreenshotNeo API documentation for request parameters and output options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free to try it.

Frequently asked questions

Can I use JavaScript in a footer template to calculate its contents?

No. Playwright’s API documentation says scripts inside templates are not evaluated. Prepare the value outside the template instead.

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.

Does switching to screen media make page CSS apply to the footer?

No. Media emulation affects page rendering; Playwright documents template styling as a separate scope, and page styles are not visible inside header/footer templates.

Does an old GitHub issue prove my current installation has a parser defect?

No. An issue report documents a user’s reported setup and symptoms. Reproduce the problem with your current version and a minimal case before treating it as a general defect.

Quick Recap

Bestseller No. 1
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
Amazon Basics Multipurpose Copy Printer Paper, 8.5 x 11 Inches, 20 lb, 92 Bright, White, 1 Ream (500 Sheets), Jam-Free
1 ream (500 sheets) of 8.5 x 11 white copier and printer paper for home or office use; Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$6.97
Bestseller No. 2
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
HP Printer Paper | 8.5 x 11 Paper | Copy &Print 20 lb | 1 Ream Case - 500 Sheets| 92 Bright | FSC Certified | 200060
Sheet size – 8.5 x 11; Thickness – 20 pounds; Brightness – 92 bright white
$6.97
Bestseller No. 3
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 3 Reams (1,500 Sheets), 92 Bright White for Home Use
Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$21.96
Bestseller No. 4
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 5 Reams (2,500 Sheets), 92 Bright White
Amazon Basics Multipurpose Copy Printer Paper, 20 lb, 8.5 x 11 Inches, 5 Reams (2,500 Sheets), 92 Bright White
Virgin copy paper providing professional quality results; acid-free to prevent yellowing
$29.14

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.