The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Generating a PDF and downloading it are two separate steps. First, convert the HTML into valid PDF bytes; then either link to an existing PDF, turn in-memory bytes into a browser download, or return the bytes from a server with PDF response headers. Which path works best depends on where the conversion runs and whether the PDF already exists.
Choose where to generate the PDF
Start by locating the conversion step. An anchor cannot turn HTML into a PDF by itself: it only points the browser at a file or data. A filename ending in .pdf and the MIME type application/pdf do not convert HTML text into a valid PDF.
- The PDF already exists: Link to its URL and use the anchor
downloadattribute when the URL is same-origin. - The browser generated PDF bytes: Wrap those bytes in a Blob, create an object URL, and trigger a download from a user action.
- Your server generates the PDF: Render HTML in a suitable runtime and return actual PDF bytes with appropriate response headers.
- You want a managed converter: Compare a hosted API’s supported inputs, authentication, request limits, pricing, and data-handling terms against your requirements.
Download a PDF that already has a URL
If your site already serves the PDF, use a normal anchor. The download attribute suggests a download and filename, but does not guarantee that every browser will save the file rather than display it. Its download behavior is supported for same-origin URLs and blob: and data: URLs; it is not a general way to force a download from an arbitrary cross-origin URL.
<a href="/reports/report.pdf" download="report.pdf">Download PDF</a>
The browser’s settings and response headers also affect what happens. In particular, a filename supplied by the response’s Content-Disposition header can take precedence over the filename in the anchor. See MDN’s anchor element reference and test the actual route in the browsers your application supports.
#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
Generate the PDF in the browser and download its bytes
When client-side code has already produced valid PDF bytes, create a Blob with the PDF media type and download its object URL. Connect this function to a button or another user action. Handle generation errors before starting the download.
async function downloadPdf(pdfBytes, filename = "report.pdf") {
const blob = new Blob([pdfBytes], { type: "application/pdf" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = filename;
document.body.appendChild(link);
link.click();
link.remove();
// Revoke the URL when your application's download lifecycle allows it.
URL.revokeObjectURL(url);
}
pdfBytes must come from a PDF generator or a server response. Passing an HTML string to this function does not make a PDF. Object URLs should not be kept indefinitely, but there is no single revocation delay established here as correct for every browser and application; test the lifecycle you implement.
Use html2pdf.js for client-side conversion
html2pdf.js converts a webpage or selected element in the browser and documents a save flow. It is a browser-side option, not a Node.js conversion library. Its rendering and page-break behavior are part of the choice: verify that the output preserves the layout you need, especially for long pages and complex CSS.
The project’s documentation shows both browser inclusion and npm installation routes. When using a CDN, choose a versioned URL rather than an unversioned asset so upgrades do not silently change the code your page receives.
Generate and deliver the PDF from a server
Server-side rendering is useful when conversion should happen outside the visitor’s browser or when you need control over navigation, readiness, and print settings. Keep API keys and other service credentials on the server; do not expose them in client-side JavaScript.
Puppeteer example
Puppeteer’s PDF guide uses page.goto() followed by page.pdf(), and its example waits for networkidle2 before printing. The PDF call waits for fonts by default. Choose a readiness condition appropriate to your page rather than assuming that navigation completion means all application content has rendered.
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⁴
import puppeteer from "puppeteer";
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto("https://example.com/report", {
waitUntil: "networkidle2",
});
const pdfBytes = await page.pdf({
format: "A4",
printBackground: true,
});
// Return pdfBytes from your server route as application/pdf.
} finally {
await browser.close();
}
For printing an existing page, see the Puppeteer PDF generation guide. If your page is an SPA or loads data after navigation, add an application-specific readiness signal or wait for a selector that appears only when the report is complete.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Return bytes with a downloadable response
After rendering, send the PDF bytes as the response body. Set the media type to application/pdf. If you want the server to ask the browser to download the file, set Content-Disposition: attachment with a filename, then test the interaction in supported browsers.
// pdfBytes is the actual output of a PDF renderer.
return new Response(pdfBytes, {
headers: {
"Content-Type": "application/pdf",
"Content-Disposition": 'attachment; filename="report.pdf"',
},
});
A route can instead return the PDF for inline viewing, depending on the application’s intended behavior and headers. Neither the header nor the anchor attribute overrides every browser preference in every context.
Cloudflare Browser Run
Cloudflare documents a /pdf quick action that accepts a URL or raw HTML and a Puppeteer/Playwright route for PDF creation. The quick-action endpoint has a documented 50 MB request-body limit; that is a limit for this Cloudflare endpoint, not a general limit for HTML or PDF files. Cloudflare also warns that JavaScript-heavy pages and SPAs can produce incomplete PDFs when the default load behavior captures them too early. Review the current Cloudflare /pdf documentation for its authentication and request format.
Adobe PDF Services
Adobe’s HTML-to-PDF documentation describes conversion from static or dynamic HTML, ZIP, and URL inputs, with REST and SDK examples for Node.js, .NET, Java, and Python. A hosted service can reduce the need to operate a rendering browser yourself, but check the current documentation for account setup, authentication, supported limits, pricing, and data handling before adopting it. See Adobe PDF Services HTML to PDF.
Make the rendered PDF complete and readable
Wait for content, not just navigation
Pages that fetch data or render components after initial navigation may be captured while blank or only partly complete. Wait for a page-specific ready state, a selector that marks the finished report, or a renderer-supported delay when no stronger signal exists. A generic network-idle condition can help, but it is not a substitute for knowing when your application’s content is ready.
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.
Check fonts, images, and backgrounds
Confirm that fonts and images are reachable from the renderer’s environment, including any authentication or network restrictions. Puppeteer’s PDF guide says fonts are awaited by default, but deployment conditions can still differ from local development. If CSS background colors or images are absent, check print styles and the renderer’s background-print option; Cloudflare’s HTML/CSS example uses printBackground: true.
Set print layout deliberately
Choose paper size, margins, and orientation for the document rather than relying on a browser default. Cloudflare’s HTML/CSS guide demonstrates PDF options for page dimensions, margins, and whether backgrounds print. Long reports also need print-specific CSS or page-break rules where appropriate; inspect the output for clipped content, awkward breaks, and missing sections.
Choose the right delivery method
| Method | Best fit | Key checks |
|---|---|---|
Same-origin PDF link plus download |
The file is already generated and served by your site. | Origin, filename, response headers, and browser preferences. |
| Browser library such as html2pdf.js | Conversion belongs in the browser. | Browser-only execution, layout fidelity, page size, and page breaks. |
| Puppeteer or similar browser automation | A server needs control of page readiness and print options. | Runtime and hosting, readiness, fonts/assets, margins, and background printing. |
| Hosted conversion API | A managed conversion service fits operational needs. | Accepted input, authentication, vendor terms, current pricing, limits, and data handling. |
Or skip the browser setup
If your goal is to capture a webpage as a PDF rather than build and operate a rendering browser, ScreenshotNeo provides a website screenshot API and MCP server. One request can return a PDF; the API also supports PNG, JPEG, or WebP screenshots. The call below requests a PDF by adding the documented output parameter:
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-d format=pdf
-o page.pdf
See the ScreenshotNeo API documentation for request parameters and response details. ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents, including Claude, Cursor, and other MCP clients.
The Free plan includes 1,000 shots per month with no card required. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. If this URL-based capture fits your task, sign up for ScreenshotNeo’s free plan.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common failures
The PDF is blank or missing dynamic content
The renderer may have captured the page before client-side code finished. Wait for an application-specific ready signal or a selector that confirms the content is present, and check whether required network requests succeeded. Cloudflare specifically notes this risk for JavaScript-heavy pages and SPAs in its PDF quick-action documentation.
The PDF opens in the browser instead of saving
Check whether the URL is same-origin or a Blob URL, whether the anchor has a download filename, and whether the response sets Content-Disposition: attachment. Browser settings and response headers can change the result, and the attribute cannot force downloads from arbitrary cross-origin URLs.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →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
The downloaded file is invalid
Inspect the response body and confirm it contains actual PDF bytes. Set Content-Type: application/pdf for a PDF response; do not return an HTML error page with a .pdf filename. Also handle renderer failures before writing a success response.
Fonts or images are absent
Check that assets are publicly reachable or that the rendering context has the needed cookies and credentials. Review network failures, font loading, and CSS print behavior in the renderer’s environment.
Backgrounds disappear or pages break badly
Enable background printing where supported, then inspect paper size, margins, orientation, print CSS, and page-break rules. A screen layout is not necessarily a print layout.
A Cloudflare request is rejected for size
For Cloudflare Browser Run’s /pdf quick action specifically, the documented request-body ceiling is 50 MB. Reduce or restructure that request if it exceeds the endpoint limit; do not assume the same limit applies to another provider or local renderer.
Recommended Free Tools
Frequently Asked Questions
Can the HTML download attribute force a PDF to download from any URL?
No. Its documented download behavior applies to same-origin, blob:, and data: URLs; arbitrary cross-origin URLs may not honor it.
Can I save HTML as a PDF by naming it report.pdf?
No. The file must contain PDF bytes generated by a converter; changing a filename or MIME type does not convert HTML.
Can html2pdf.js run in Node.js?
No. Its project documentation describes it as a client-side browser converter.
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.

