Send a POST request to https://api.html2pdf.app/v1/generate, authenticate with the X-API-Key header, and pass the publicly reachable webpage URL in the required html field. A successful synchronous response is PDF bytes, not JSON: check the HTTP status, then save or stream the response body as binary data.
Make a synchronous PDF from a webpage URL
The request uses JSON, with the API key kept on your server. This cURL example writes the response body to a PDF file:
As an Amazon Associate I earn from qualifying purchases.
curl --fail-with-body -X POST "https://api.html2pdf.app/v1/generate"
-H "Content-Type: application/json"
-H "X-API-Key: YOUR_API_KEY"
-d '{"html":"https://example.com"}'
--output webpage.pdf
--fail-with-body makes cURL return a failure status for HTTP errors while retaining the error response body for inspection; do not treat a resulting file as a valid PDF unless the HTTP request succeeded. The API’s documented request shape and binary response are described in HTML2PDF.app’s API documentation and its official examples.
Python: preserve the response bytes
import requests
api_key = "YOUR_API_KEY"
payload = {"html": "https://example.com"}
response = requests.post(
"https://api.html2pdf.app/v1/generate",
headers={
"Content-Type": "application/json",
"X-API-Key": api_key,
},
json=payload,
timeout=90,
)
response.raise_for_status()
with open("webpage.pdf", "wb") as pdf_file:
pdf_file.write(response.content)
The wb mode writes bytes unchanged. raise_for_status() prevents an HTTP error body from being saved as though it were a PDF.
#1 Best Overall
- PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
- QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
- VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
- INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
- EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
Node.js: check status and write a buffer
import { writeFile } from "node:fs/promises";
const response = await fetch("https://api.html2pdf.app/v1/generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": process.env.HTML2PDF_API_KEY,
},
body: JSON.stringify({ html: "https://example.com" }),
});
if (!response.ok) {
const errorBody = await response.text();
throw new Error(`HTML2PDF.app returned HTTP ${response.status}: ${errorBody}`);
}
const pdf = Buffer.from(await response.arrayBuffer());
await writeFile("webpage.pdf", pdf);
Use a supported Node.js version with built-in fetch, or provide a compatible fetch implementation. In a web framework, the same bytes can be streamed to the client with a PDF content type; avoid converting them to a text string.
URL input or raw HTML?
| Input | Put in html |
What to consider |
|---|---|---|
| Webpage | A full public URL, such as https://example.com |
The conversion service must be able to access that URL and its required CSS, fonts, images, and other resources. |
| Markup you generate | Raw HTML text | Use this when your application owns the markup rather than asking the service to retrieve a webpage. Referenced assets still need to be available to the renderer. |
The API accepts either a URL or raw HTML in the required html field. A private page that requires a browser session may not be retrievable merely by supplying its URL; for controlled content, consider generating markup server-side and submitting it as HTML, while ensuring any external resources the markup needs are reachable.
Rank #2
- FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
- READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
- WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
- OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)
Tune page size, layout, and rendering
HTML2PDF.app documents options for page geometry and browser rendering. The vendor describes its conversions as running in headless Chromium with support for modern HTML, CSS, and JavaScript; actual output still depends on the selected settings, page assets, fonts, and script timing.
| Setting | Use it to | Documented choices or behavior |
|---|---|---|
| Orientation | Choose page direction | Portrait or landscape. |
| Format | Select a standard paper size | Letter, Legal, Tabloid, Ledger, and A0 through A6. |
| Width and height | Specify custom page dimensions | Custom dimensions in pixels. |
| Margins | Reserve printable space around content | Set the four margins. Leave sufficient top or bottom margin when using header or footer templates. |
| Media | Choose which CSS media rules apply | Print or screen. |
| Scale | Adjust rendered content size | Documented range: 0.1–2. |
waitFor |
Allow page scripts or asynchronous resources more time | Documented range: 0–10 seconds. |
| Filename | Set the generated document name | A filename option is supported. |
| Header and footer templates | Add repeated page furniture | Templates are supported; provide enough corresponding margin for them to appear. |
Set options in the JSON body alongside html, using the parameter names and accepted values in the current API documentation. For example, to try landscape output with a longer rendering wait, add the corresponding documented orientation and waitFor fields to the payload. Verify exact option names and enum values in the documentation before deploying, because settings are product-specific.
Rank #3
- STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
- CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
- HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
- FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
- BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer
Choose settings based on the page
- Use print media when the site has print styles that remove navigation or reflow content; use screen media when the on-screen layout is the intended result.
- Try landscape for wide tables or dashboards, and a supported paper format that suits the page’s proportions.
- Adjust margins if content is clipped or if a header or footer overlaps the body.
- Increase
waitForonly when content appears after client-side scripts or asynchronous loading. The documented limit is 10 seconds; waiting does not fix inaccessible resources or failed scripts. - Use scale to fit content more comfortably, but inspect readability and pagination after changing it.
Choose synchronous output or a callback
| Workflow | Best fit | How the PDF arrives |
|---|---|---|
| Synchronous | Your request handler or job can wait for completion and process the result immediately. | The HTTP response body contains the PDF bytes. Check status and save or stream the bytes. |
| Callback | Generation belongs in a background workflow and the initiating request should not hold the connection open. | Supply callBackUrl; on completion the service posts a base64-encoded PDF in a document field. An optional state value is returned unchanged for correlating the callback to the job. |
For callbacks, expose a receiver endpoint that can accept the completion request, decode the base64 document into bytes, and associate it with the originating job. Validate incoming callback requests according to the vendor’s current documentation and your application’s security requirements. The reviewed API material documents the callback payload and optional correlation state; consult the API documentation for the current request details.
Keep the API key and document data appropriately protected
Store the API key in a server-side secret store or environment configuration and make calls from a backend or trusted job. HTML2PDF.app warns against exposing the key in browser JavaScript, public repositories, or client-side templates. If a key is exposed, rotate it through the vendor’s account controls.
Rank #4
- IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
- IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
- IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
- IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
- Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management
HTML2PDF.app says generated PDFs are processed temporarily rather than permanently stored on its servers. Its documentation also says raw HTML or text in the html parameter is not stored in conversion logs, while selected request metadata and a source URL supplied in html may be retained. These are vendor statements, not an independent audit. For sensitive or regulated material, review the vendor’s privacy policy and data processing agreement before sending content.
Troubleshoot blank, incomplete, or misformatted PDFs
- The output file is actually an error response: Check the HTTP status before saving or serving the body. Log the status and inspect the error response rather than assuming every response is a PDF.
- The PDF is blank: Confirm the source URL is publicly accessible from the conversion service and that it does not require your logged-in browser session. Check that required CSS, fonts, and images can be reached.
- Styles or images are missing: Inspect the page’s asset URLs and access rules. The renderer needs access to external resources referenced by the page; relative or protected resources may not resolve as expected.
- JavaScript-generated content is absent: Add a suitable
waitFordelay within the documented 0–10 second range, then verify the page actually renders that content without an interactive login or other browser-only state. - Content is clipped or split awkwardly: Try a different paper format or orientation, tune margins and scale, and compare print versus screen media. Recheck pagination after each change.
- Headers or footers do not appear: Check that the template is configured as documented and that the page reserves enough top or bottom margin for it.
Or skip the browser setup
If the job is to capture a webpage as an image or PDF rather than build your own rendering pipeline, ScreenshotNeo provides a one-request screenshot API and an MCP server for AI agents. Its PDF option also supports paper size, margins, landscape, and page ranges. This captures a page rather than serving as a drop-in Html2Pdf.app integration.
Best Value
- Scanner type: Document
- Connectivity technology: USB
- With Auto Scan Mode, the scanner automatically detects what you're scanning
- Digitize documents and images
For a screenshot response, cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options and supported response formats. It accepts cookie or consent banners as a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server includes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Frequently Asked Questions
Does a successful synchronous conversion return JSON?
No. The documented successful synchronous response is PDF data in the HTTP response body.
Free tools Windows power users keep installed
One-click scans. No signup required.
Can I convert a webpage that only I can access while logged in?
A URL alone does not provide your browser session. The conversion service needs a publicly reachable source or markup and resources you can submit in a way the service can access.
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.




