Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesTo add a header or page numbers to an Html2Pdf.app PDF, pass HTML in the API’s headerTemplate or footerTemplate fields, then reserve enough space with marginTop or marginBottom. Use pageNumber and totalPages spans for numbering. For a one-off conversion, the online converter also provides header and footer controls.
Choose the API or online converter
| Workflow | Best for | What you need to know |
|---|---|---|
| Online converter | One-off or interactive conversion | The converter provides header and footer controls and is presented as a free demo without an API key. Html2Pdf.app online converter |
| API | Repeated or application-driven PDF generation | Send a POST request to https://api.html2pdf.app/v1/generate with an X-API-Key header. A successful synchronous response contains PDF binary data. API documentation |
The steps and code below are for automated API use. Keep the API key in a server-side environment or another trusted backend location; do not expose it in browser JavaScript or public code.
Add a header, footer, and page count
-
Put the markup for the top of each page in
headerTemplate, and/or the markup for the bottom infooterTemplate. -
Use spans with the classes
pageNumberandtotalPageswhere the current page and total page count should appear. The supported dynamic template classes also includedate,title, andurl.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 →Clear out junk files and repair common Windows errorsFree Scan →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing- BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
- FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
- FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
- BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
- CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)
-
Set
marginTopand/ormarginBottomto leave space for the relevant template. These values are in pixels. The values in the example below are illustrative starting points, not universal settings; adjust them to the height of your header or footer and your page layout. -
Style the template within its own markup. Header and footer templates do not inherit CSS from the source page. External resources cannot load inside templates, so embed any required image as a base64 data URL.
Minimal request body
{
"html": "<h1>Example report</h1>",
"headerTemplate": "<div style="font-size: 12px; text-align: center;">Example report</div>",
"footerTemplate": "<div style="font-size: 12px; text-align: center;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>",
"marginTop": 40,
"marginBottom": 40
}
The margin numbers are examples only. Increase them if the template is clipped or overlaps page content; reduce them if the reserved area is unnecessarily large.
Rank #2
- BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
- COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
- BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
- VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
- BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
Send the API request and save the PDF
Here is a complete cURL example. Replace YOUR_API_KEY with a key held securely on your backend. The request body is JSON, and the response is written to a PDF file as binary data.
curl -X POST "https://api.html2pdf.app/v1/generate"
-H "X-API-Key: YOUR_API_KEY"
-H "Content-Type: application/json"
--data '{"html":"<h1>Example report</h1>","headerTemplate":"<div style="font-size: 12px; text-align: center;">Example report</div>","footerTemplate":"<div style="font-size: 12px; text-align: center;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>","marginTop":40,"marginBottom":40}'
--output report.pdf
For application code, follow the official API documentation for request parameters and authentication. Check the HTTP status before treating the response as a completed PDF, and handle successful response content as bytes—not JSON or text.
Check the rendered result
-
Confirm the header or footer appears on the intended pages and that its contents are not clipped.
Rank #3
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only- FAST PRINT SPEEDS: Print up to 19 pages per minute.
- COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
- WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
- PAPER CAPACITY: Up to 150 sheets.
- SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.
-
Verify page numbering uses both spans:
pageNumberfor the current page andtotalPagesfor the total. -
If the template includes styling, confirm that the required styles are written in the template itself rather than only in the source document.
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 →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
If the PDF is blank or missing source-page styling, confirm the source URL is public and that its CSS, fonts, images, and other required resources are reachable by the rendering service.
Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa- BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
- COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
- BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
- VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
- BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer
Troubleshooting common problems
Header or footer is missing or cut off
The reserved top or bottom margin may be too small for the template. Increase marginTop for a header or marginBottom for a footer, then regenerate and inspect the layout.
Page numbers do not appear
Check that the template uses the exact class names pageNumber and totalPages on span elements. The page number and page count are inserted dynamically; ordinary text such as “Page 1 of 4” will not update automatically.
Template styles or images are missing
Template CSS does not inherit from the source page, and external resources cannot load in a header or footer template. Include the necessary styles inline in the template and embed images as base64 data URLs.
Best Value
- FROM AMERICA'S MOST TRUSTED PRINTER BRAND – Perfect for small teams printing professional-quality black & white documents and reports. Perfect for 1-3 people
- WORLD'S SMALLEST LASER IN ITS CLASS – Precision laser printing that fits anywhere
- FAST PRINT SPEEDS – Up to 21 black-and-white pages per minute single-sided
- WIRELESS WITH SELF-RESET – Helps you stay connected
- PRINT FROM ANY DEVICE – Wireless printing from any mobile device, PC or tablet. Works with Microsoft, Mac, AirPrint, Android, Chromebook and more
The generated PDF is blank or lacks page styles
Check that the submitted HTML or source URL is valid and that linked CSS, fonts, images, and other resources are publicly reachable by the rendering service. The official Python example also demonstrates the API request pattern.
The client cannot parse the response
A successful synchronous API response is PDF binary data, not a JSON object or text document. Check the HTTP status and write the response body to a file or binary stream without decoding it as text.
Or skip the browser setup
If your actual need is a clean screenshot of a web page rather than a paginated PDF with a custom header or footer, ScreenshotNeo can return a PNG, JPEG, WebP, or PDF from one GET request. It accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. ScreenshotNeo also has an MCP server for AI agents, including Claude, Cursor, and other MCP clients.
Example cURL request, using a page URL and API key:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated 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 matchcurl -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 documentation for options and setup. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for free ScreenshotNeo access.
Frequently Asked Questions
Can Html2Pdf.app number pages without a custom header or footer?
The documented page-count placeholders are used inside header or footer templates. Place the relevant span in one of those templates to display numbering.
Can I use the source page’s stylesheet to style the header template?
No. Header and footer templates do not inherit the source page’s CSS; include the styles the template needs in its own markup.
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.
Recommended Free Tools

