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 →Repair Windows errors before they cause bigger problemsFix Now →Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To generate a PDF from a webpage with an API, either render the page in a browser you control and call Playwright’s page.pdf(), or use a hosted PDF endpoint that accepts a URL or HTML. Playwright gives you detailed control over print layout; a managed API avoids operating the browser yourself. The right choice depends on what you need to render, how much control you need, and which service’s current limits and data-handling terms you can verify.
Choose an approach based on your input and constraints
Start with the source you have and the control you need. A URL can be opened in a browser and printed; generated HTML can be loaded into a browser page and printed. For packaged or dynamic HTML, check whether the chosen service supports the input format and whether it can load the assets and scripts your document depends on.
| Approach | Useful when | Trade-off |
|---|---|---|
| Playwright in your application | You want control of the browser, print CSS, page size, margins, and other PDF settings. | You operate the browser automation and its deployment. |
| Cloudflare Browser Rendering | You want a hosted PDF endpoint or already use Cloudflare Workers. | Verify current access requirements, limits, pricing, regional availability, and data handling. |
| Adobe PDF Services | You need a managed HTML-to-PDF workflow and your input is static HTML, dynamic HTML, ZIP, or a URL. | Verify current API terms, limits, and the fit of its supported inputs. |
Cloudflare documents a /pdf endpoint accepting either a URL or HTML, with REST and Workers-binding invocation paths. Its Browser Rendering page was last updated September 26, 2026. Adobe documents HTML-to-PDF conversion for static and dynamic HTML, ZIP, and URL inputs. Neither fact establishes current comparable pricing or quotas, so check vendor documentation before choosing on cost.
Outdated 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 matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Generate a PDF yourself with Playwright
Playwright’s page.pdf() returns a PDF buffer. By default it renders with print CSS media, so a page’s print stylesheet can change layout and visibility compared with its screen appearance. If you want screen media instead, call page.emulateMedia({ media: 'screen' }) before page.pdf(). Print output can also alter colors; Playwright’s documentation points to -webkit-print-color-adjust when exact colors are needed.
#1 Best Overall
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
Install and run a URL-to-PDF script
In a Node.js project, install Playwright and its browser using the current Playwright installation instructions for your environment. Then save this as url-to-pdf.mjs and run it with Node.js. The script opens the URL, waits for the page load event, and writes a PDF.
import { chromium } from 'playwright';
const url = process.argv[2];
if (!url) {
throw new Error('Usage: node url-to-pdf.mjs <url>');
}
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'load', timeout: 60_000 });
const pdf = await page.pdf({
format: 'A4',
printBackground: true,
margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' },
});
await import('node:fs/promises').then(({ writeFile }) => writeFile('page.pdf', pdf));
} finally {
await browser.close();
}
Run it as node url-to-pdf.mjs https://example.com. The example uses A4 paper, prints backgrounds, and sets 12 mm margins. Change those values to match the page and your intended document; a successful render does not guarantee that the result’s pagination or visual design is suitable.
Print supplied HTML instead of navigating to a URL
For HTML your application already generated, use page.setContent() and then page.pdf(). Make sure the HTML’s referenced fonts, images, and stylesheets are available to the browser; missing or inaccessible assets can produce a PDF that differs from the intended design.
Rank #2
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- 1 Year License for 1 Windows & 2 Mobile (Android and/or iOS) devices.
import { chromium } from 'playwright';
const html = `<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
@page { size: A4; margin: 15mm; }
body { font: 12pt/1.5 sans-serif; }
</style>
</head>
<body><h1>Monthly report</h1><p>Report content goes here.</p></body>
</html>`;
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.setContent(html, { waitUntil: 'load' });
const pdf = await page.pdf({ printBackground: true, preferCSSPageSize: true });
await import('node:fs/promises').then(({ writeFile }) => writeFile('report.pdf', pdf));
} finally {
await browser.close();
}
preferCSSPageSize: true lets the page’s CSS @page size take precedence over PDF width, height, or format options. Use this when the stylesheet is intended to control paper size; otherwise set the desired format or dimensions in the PDF options.
Choose print or screen media intentionally
Use the default print media when you want the page’s print-specific rules, such as simplified navigation or print-sized typography. If the PDF should match screen styling, emulate screen media before printing:
await page.emulateMedia({ media: 'screen' });
const pdf = await page.pdf({ printBackground: true });
For backgrounds and colors, set printBackground: true when background graphics should appear. If exact colors matter, the page CSS can use -webkit-print-color-adjust, as described in Playwright’s documentation. Check the resulting PDF: media emulation and color adjustment do not fix missing assets, layout overflow, or content that is intentionally hidden by page CSS.
Rank #3
- Convert over 50 document file formats.
- Preview your files from Doxillion before converting them.
- Use batch conversion to convert thousands of files at once.
- Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
- Burn your converted or original files directly to disc.
Settings worth tuning
Playwright’s PDF API includes controls for paper format (including Letter and A4), explicit width and height, margins, header and footer templates, page ranges, background printing, scale, and preferCSSPageSize. Set only the options your output requires:
- Paper and margins: Choose the page dimensions and whitespace appropriate for the reader and document. A CSS
@pagerule and API paper settings can interact; usepreferCSSPageSizedeliberately. - Backgrounds: Enable background printing when colored fills or background graphics are part of the document.
- Page ranges: Request only the desired pages when producing a partial document.
- Headers and footers: Use templates when printed pages need repeated labels or page information; preview the result because these occupy space on the page.
- Scale: Adjust only if the page’s content does not fit as intended; scaling can make text too small.
Before using the output in production, inspect representative pages, including long tables, page breaks, links, and content near the margins. Web layouts are not automatically well-designed print layouts.
Use a managed PDF API
Cloudflare Browser Rendering
Cloudflare documents its /pdf endpoint for generating a PDF from a webpage or custom HTML. The documented input is either url or html. You can call it through the REST API with a Browser Rendering edit token or invoke it through Workers bindings. This is a natural route if your application is built around Cloudflare Workers, but confirm current authentication details, endpoint behavior, and service limits in Cloudflare’s documentation before deployment.
Rank #4
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs.
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs.
- 1 Year License for 1 Windows & 2 Mobile (Android and/or iOS) devices.
Adobe PDF Services
Adobe documents an HTML-to-PDF operation for static and dynamic HTML, ZIP, and URL inputs. Its documentation includes an API request example using an API key and bearer authorization. This may fit workflows that need those input types, but check the current documentation for setup, request details, limits, and pricing that apply to your account.
Evaluate hosted services before sending real documents
For any hosted API, verify the current security and data-handling terms, retention behavior, reliability expectations, file and request limits, regional availability, and pricing. These points are not established on a directly comparable basis for the services described here. Test with representative documents and confirm how errors are reported before making the endpoint part of a critical workflow.
Troubleshoot common PDF-generation problems
- The PDF looks different from the browser:
page.pdf()uses print media by default. Check the site’s print CSS or emulate screen media before printing if screen styling is required. - Background colors or images are missing: Enable
printBackground. For color fidelity, check the page’s print color CSS and inspect the generated file. - The expected paper size is ignored: Check whether the page defines CSS
@page. WithpreferCSSPageSize: true, that CSS page size takes precedence over API width, height, or format settings. - Images, fonts, or styles are missing: Confirm the browser can access the referenced assets and that they have loaded before printing. For supplied HTML, verify its asset URLs and deployment access.
- The output cuts off content or creates awkward page breaks: Review the print stylesheet, paper dimensions, margins, scale, and page-break behavior. Inspect several pages rather than relying on the first page alone.
- A managed request fails: Check the provider’s current authentication requirements, whether the request uses the supported input type, and any documented limits. For Cloudflare REST calls, the documentation specifies a Browser Rendering edit token; its Workers binding is a separate invocation path.
Performance, reliability, and cost decisions
With Playwright, your application is responsible for browser execution and deployment. That gives you direct access to browser and PDF settings, but it also means you must operate the automation and handle failures in your own workflow. A hosted API shifts browser execution to a provider, but introduces provider-specific authentication, service terms, and limits that you should verify.
Best Value
- Save money by using PDF Fusion to view over 100 file formats without having to purchase additional software
- Merge incompatible files quickly and easily by dragging and dropping in PDF Fusion to create a new PDF documents
- Save time with PDF Fusion's editing tools to reuse the content from existing documents without starting from scratch
Do not choose a provider based on an assumed price or quota: current comparable prices, quotas, and regional availability are not established here. For a cost estimate, measure your expected document volume against each provider’s current published terms and include the cost of your own browser infrastructure if you self-host. For reliability, test slow pages, unavailable assets, and representative long documents, and decide how your application should report and retry failures.
Or skip the browser setup
ScreenshotNeo is a website screenshot API that also supports PDF output. It is useful when you want a managed request rather than running browser automation yourself. The request below follows the documented ScreenshotNeo one-call example; consult the ScreenshotNeo API documentation for the PDF response configuration and current request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses say which page verdict and billing outcome applied. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Those plan quantities are screenshots, so check the current product documentation for the PDF workflow that fits your use case. Sign up for 1,000 free screenshots a month with no card.
Implementation checklist
- Decide whether your input is a rendered URL, generated HTML, or a packaged input such as ZIP.
- Choose self-managed Playwright when browser and print controls matter; otherwise evaluate a hosted endpoint that supports your input and deployment.
- Set print or screen media intentionally, then configure paper, margins, backgrounds, and CSS page-size behavior.
- Test representative documents and confirm asset loading, pagination, error handling, and the provider’s current terms before production use.
Frequently Asked Questions
Can an API generate a PDF from a URL without converting the page to HTML first?
Yes. Cloudflare Browser Rendering documents a PDF endpoint that accepts a URL as an input; Playwright can also navigate to a URL and print the rendered page.
Can I create a PDF from HTML that my application generates?
Yes. Playwright can load supplied HTML with page.setContent() before calling page.pdf(). Cloudflare documents HTML input, and Adobe documents static and dynamic HTML inputs.
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.

