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

To generate a PDF from a URL with Html2Pdf.app, send a server-side JSON POST request to https://api.html2pdf.app/v1/generate, authenticate with an X-API-Key header, and save the successful response as binary data. The Node.js example below uses native fetch (Node.js 18 or newer) and keeps the API key out of browser code.

Generate and save a PDF in Node.js

Install no extra HTTP package if you are using Node.js 18 or newer: it includes native fetch. Set HTML2PDF_API_KEY in the server process environment, then save this as an ES module file such as generate-pdf.mjs and run it with node generate-pdf.mjs.

import { writeFile } from 'node:fs/promises';

const apiKey = process.env.HTML2PDF_API_KEY;
if (!apiKey) {
  throw new Error('Set the HTML2PDF_API_KEY environment variable first.');
}

const response = await fetch('https://api.html2pdf.app/v1/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': apiKey,
  },
  body: JSON.stringify({ html: 'https://www.example.com' }),
});

if (!response.ok) {
  const detail = await response.text();
  throw new Error(`PDF generation failed (${response.status}): ${detail}`);
}

const pdf = Buffer.from(await response.arrayBuffer());
await writeFile('document.pdf', pdf);
console.log('Saved document.pdf');

Replace the example address with a publicly reachable page URL. The required html field also accepts raw HTML markup. A successful synchronous request returns PDF bytes, not JSON; check the HTTP status before converting the response body, and do not parse a successful response as text or JSON. The vendor’s Node.js guide specifies Node.js 18 or newer and documents this request and binary-save pattern: Html2Pdf.app Node.js examples.

Keep credentials on the server

Do not put the API key in browser JavaScript, a public repository, or a client-side template. Store it in an environment variable or a server-side secret manager, and ensure error logging does not expose it. The request authenticates through the X-API-Key header.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose the rendering options

Add options as fields in the JSON body alongside html. The documented defaults and ranges below are from the Html2Pdf.app documentation. They are controls to test with your page, not a guarantee that every site will render identically.

Option What it controls Documented default or range
format Paper size: Letter, Legal, Tabloid, Ledger, or A0 through A6. A4
landscape Landscape orientation. false
width, height Custom page dimensions in pixels; provide them together. Not stated
marginTop, marginRight, marginBottom, marginLeft Page margins in pixels. 0
filename Returned filename. Not stated
waitFor Additional wait time for JavaScript or asynchronous resources, in seconds. 0–10
media CSS media mode: print or screen. screen
scale Rendered scale. 1; range 0.1–2
headerTemplate, footerTemplate HTML snippets for page headers and footers. Not stated; allow enough top or bottom margin for them to show
callBackUrl, state Completion callback URL and an optional correlation value echoed to that callback. Not stated

For example, an options-bearing body can look like this:

body: JSON.stringify({
  html: 'https://www.example.com',
  format: 'Letter',
  landscape: false,
  marginTop: 24,
  marginRight: 24,
  marginBottom: 24,
  marginLeft: 24,
  media: 'print',
  waitFor: 2,
  scale: 1,
})

The service describes a headless Chromium renderer. CSS media rules, available fonts and remote assets, and when a page’s JavaScript finishes can all affect the result. Render representative pages and inspect the PDF before relying on a chosen layout in production.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Choose synchronous delivery or a callback job

A normal request keeps the connection open until conversion finishes and returns the PDF in its binary response. Use a callback when your application is designed to queue work and receive completion separately; the documentation does not prescribe a latency threshold for switching workflows.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Synchronous request Callback job
Completion Request stays open until generation finishes. Accepted first; completion is sent later.
PDF delivery Binary response body. Callback JSON contains the base64-encoded PDF in document.
Application needs A caller that can wait for the response. A publicly reachable HTTPS callback endpoint, correlation handling, and idempotent processing.

To use the callback path, include callBackUrl in the request, and optionally include state to correlate the completion with your own job. An accepted job returns 202 Accepted; that response is queue confirmation, not the PDF. When conversion completes, Html2Pdf.app POSTs JSON to the callback URL with the document encoded in base64. The documentation says failed callback delivery may be retried up to three times, so make the receiver idempotent rather than processing duplicate deliveries as separate documents.

Handle failures and rendering problems

Interpret HTTP errors before retrying

  • 400: The source URL may be inaccessible to the service, or a parameter may be invalid. Check that the URL is public and verify option names and values.
  • 401: The API key is missing or invalid. Check the server environment and the X-API-Key header.
  • 403: The request may exceed a plan limit. Check the account’s current plan and limits before resubmitting.
  • 500: The service reports an unhandled server error. The documentation recommends retrying after a short delay, with increasing intervals. Avoid an immediate retry loop.

These status meanings and recommendations are from the vendor documentation. For 400, 401, and 403 responses, fix the input, credential, or plan issue rather than repeatedly sending the same request.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Diagnose blank pages or missing styles

  • Confirm the page is publicly reachable and does not require an interactive login, private network access, or a browser session unavailable to the renderer.
  • Check that CSS, fonts, images, and other required remote resources can be fetched by the rendering service.
  • If page content appears only after client-side code runs, try an appropriate waitFor value within the documented 0–10 second range. More wait time is not a guarantee that every asynchronous page will finish rendering.
  • Compare media: 'screen' with media: 'print' if print-specific CSS changes the layout.
  • Review paper size, margins, orientation, and scale if content is clipped or unexpectedly paginated.

Security, PDF protection, and data handling

The documentation says the userPassword request option enables PDF encryption and that the service uses 128-bit AES. Permission options can restrict actions such as printing, modification, copying, or form filling. Choose encryption and permissions according to the document’s actual access requirements; they do not replace protecting the source URL, API key, or delivered file.

Html2Pdf.app states that generated PDFs are processed temporarily and are not permanently stored on its servers, while selected request metadata and a supplied source URL may be retained in logs. This is the vendor’s own description, not an independent audit. Review its documentation, Privacy Policy, and Data Processing Agreement for the terms relevant to your data before sending sensitive material.

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.

Cost and operational planning

Html2Pdf.app’s homepage, accessed in 2026, lists Free at 100 credits per month with up to 1 MB per file; Startup at $9/month for 1,000 credits; Standard at $25/month for 5,000 credits; and Scale at $39/month for 10,000 credits. The homepage says each 5 MB chunk of generated document size counts as one credit. These are vendor-published figures recorded in 2026, not a promise that prices or quotas will remain unchanged; verify the current plan terms at Html2Pdf.app before budgeting.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

For reliability, decide how your application will handle non-success responses, timeouts, duplicate callback delivery, and file storage. Test pages with the CSS, fonts, images, and JavaScript behavior your real workload uses; the service’s options can influence rendering, but cannot ensure every source page behaves the same way.

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

Or skip the browser setup

If the job is to capture a page as an image or PDF rather than to use Html2Pdf.app specifically, ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. Its capture flow can accept cookie or consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before the shot; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status.

For a URL-to-PDF call, use the documented endpoint and request format at ScreenshotNeo API documentation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The API also supports PDF output. ScreenshotNeo’s MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Frequently Asked Questions

Can the Html2Pdf.app URL-to-PDF request run from a browser?

The API key must remain server-side; send the authenticated request from your Node.js backend rather than exposing the key in browser JavaScript.

Does Html2Pdf.app return JSON on a successful synchronous request?

No. A successful synchronous response contains PDF binary data. Check the HTTP status, then read the bytes.

What does a 202 response mean when using a callback?

It means the job was accepted. The PDF arrives later as base64 in the callback’s JSON `document` field.

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

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.