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.

The reliable way to convert HTML containing images to PDF is to send either the HTML, a page URL, or a supported file/archive to an HTML-to-PDF API, then save the returned PDF bytes. Images must be reachable by the rendering service (or uploaded, packaged, or embedded in a format that service supports). Set page, print, background, viewport, margin, and wait options explicitly, and inspect the result for missing images and layout changes.

Choose the input your API supports

HTML-to-PDF services do not share one request format. Select the input mode that matches how your application produces documents.

Raw HTML

Send generated markup when your server renders a template, invoice, report, or email. This is usually the most deterministic option because the document is assembled before the conversion request. If the markup uses relative URLs, provide a documented base URL or convert those references to resolvable URLs.

Public URL

Send a page URL when the renderer can reach it from its own network. The page must be available without your browser’s cookies, VPN, localhost network, or interactive login unless the provider documents headers, cookies, or another authenticated mechanism.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

File or archive

Use an uploaded HTML file, ZIP, or asset bundle when the provider supports it and the document depends on local images, stylesheets, fonts, or scripts. Adobe PDF Services documents HTML, ZIP, and URL conversion examples. HTMLPDF documents URL, file, and HTML as mutually exclusive inputs.

Make every image available to the renderer

A browser showing an image does not prove that a remote conversion worker can fetch it. During rendering, the service must obtain the image bytes before it writes the PDF.

Use resolvable image references

  • Prefer absolute HTTPS URLs for public assets.
  • Check that each response returns an image content type rather than an HTML login page or redirect.
  • Do not rely on a developer-machine path such as file:///Users/name/photo.png unless the provider explicitly accepts uploaded files.
  • Do not assume the renderer inherits your browser session, cookies, VPN, or private DNS.

For private or reusable assets, use the provider’s documented upload or package facility. Some services support data URIs for inline images; PDFSpark documents data URI and external URL support, but that behavior should not be generalized to every API. Confirm size limits before embedding large images.

Remember CSS backgrounds

An <img> element and a CSS background-image are separate rendering cases. HTMLPDF documents an image-loading option and a separate print-media/background behavior. PDF.co exposes a printBackground control. If a logo is a background, enable background printing and test it independently from ordinary image loading.

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

Render JavaScript-created content deliberately

Many modern pages insert images after the initial HTML response. A converter that captures immediately can produce a PDF with empty image boxes or an incomplete layout. Choose a service that documents JavaScript execution and configure a wait condition appropriate to the page.

  • Selector wait: wait until a distinctive image, chart, or report container exists.
  • Network-idle wait: useful when images and API data finish loading together; PDFSpark documents a network-idle example.
  • Fixed delay: HTMLPDF documents a configurable delay. It is simple, but a delay that is too short misses content and one that is too long increases latency.
  • Application-ready flag: if you control the page, set a DOM attribute when rendering is complete and wait for that selector.

Wait behavior is provider-specific. Verify that the option applies to both scripts and image requests, not just the initial navigation.

Set page and print behavior explicitly

Defaults differ, so make the visual contract part of your request rather than relying on undocumented defaults.

Control Why it matters
Paper size or custom dimensions Controls page breaks, printable width, and scaling.
Orientation Landscape can prevent wide tables or diagrams from being clipped.
Margins Reserve space for content, headers, and footers; insufficient margins can cause overlap.
Print versus screen CSS Print styles may hide navigation, change colors, or alter layout.
Background graphics Required for CSS backgrounds, colored sections, and some chart designs.
Viewport width and height Affects responsive breakpoints before the page is paginated.
Scale and image resolution Influences readability and file size; inspect large photographs and small text separately.
Header and footer templates Keep them inside the printable area and account for their height in margins. PDF.co documents page-number variables and warns that margins matter to avoid overlap.

A provider-neutral request workflow

  1. Build the document: render a complete HTML string or choose a URL/file input.
  2. Validate resources: resolve image URLs, stylesheets, fonts, and scripts from the converter’s network perspective.
  3. Authenticate: send the API key or bearer token exactly as the provider requires.
  4. Set rendering options: specify page format, margins, print behavior, viewport, and a wait strategy.
  5. Submit the request: use the provider’s required JSON, multipart, or form encoding.
  6. Validate the response: check the HTTP status and content type before writing bytes to a file named PDF.
  7. Inspect representative documents: test short and long pages, transparent images, background images, large images, and JavaScript-generated content.

HTMLPDF shows a POST request that writes a successful response to a PDF file. Adobe’s REST example uses an asset ID, API key and bearer authorization headers, page layout, and a wait setting. These examples illustrate different contracts; they are not interchangeable.

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

Image and layout failure troubleshooting

The PDF has blank image areas

  • Open the image URL from a network outside your development machine.
  • Check for authentication, expiring signed URLs, robots or firewall rules, and redirects.
  • Confirm that the URL returns image bytes and that the format is supported.
  • If JavaScript inserts the image, increase or replace the wait condition.
  • For private files, upload or package them using the provider’s documented mechanism.

Images appear but are low quality

Check the source pixel dimensions, renderer scale, and any PDF image optimization setting. A small source image cannot become sharp simply by increasing PDF dimensions.

CSS backgrounds are missing

Enable the provider’s background or print-background option. Also verify that the page is using print CSS rather than a print stylesheet that removes the background.

The page is clipped or unexpectedly paginated

Compare viewport width, paper size, orientation, scale, and margins. Responsive breakpoints may produce a different layout at the converter’s viewport than on your screen. Add print-specific page-break rules around tables, cards, and headings.

The response is not a PDF

Many APIs return a JSON error body with a non-2xx status. Check status and Content-Type before saving. Log the provider’s error message while keeping credentials out of logs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Fonts or icons differ

Ensure the renderer can fetch web fonts and icon assets. If the service cannot access them, use a supported uploaded asset or a fallback font and verify line wrapping again.

Reliability, performance, and cost considerations

Rendering time depends on page complexity, JavaScript, image count and size, external requests, and wait settings. Reduce unnecessary assets, serve appropriately sized images, and avoid an excessive fixed delay. For production workloads, define request timeouts, retry only failures that are safe to repeat, and record a document identifier so duplicate jobs can be recognized.

Choose synchronous output when the PDF is small and the caller can wait for the response. Use an asynchronous job and webhook when documents are large, rendering is variable, or a user does not need to hold an HTTP connection open. Confirm whether the provider returns PDF bytes directly, a download URL, or a job status before implementing storage.

There is no comparable performance, reliability, SLA, or current-price data established across the providers documented here. Compare the provider’s current terms and API limits directly rather than assuming that one service’s defaults apply to another.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a screenshot API is the better fit

If your goal is a visual capture of a public page rather than a text-oriented, paginated document, ScreenshotNeo is the first service to try: it removes consent banners, newsletter popups, and chat widgets before capture, bills only clean shots, and has the lowest paid plan among its listed plans. It can return PNG, JPEG, WebP, or PDF and offers controls such as full-page capture, lazy-image loading, custom CSS and JavaScript, waits, headers, cookies, viewport and device settings, and PDF page options.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—let Claude, Cursor, or another MCP client request captures without you maintaining browser automation. The API can remove cookie banners, popups, and chat widgets before the shot; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

For a direct URL capture, use the documented request pattern:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo API documentation for PDF and rendering options. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000, and every feature is included on every plan. Create a free ScreenshotNeo account.

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

Final validation checklist

  • Every image URL is reachable by the rendering service.
  • Private assets use a documented upload, package, credential, or inline-data method.
  • JavaScript content has a verified wait condition.
  • Paper size, viewport, orientation, margins, print CSS, and backgrounds are explicit.
  • Headers and footers fit inside reserved margins.
  • Your code checks status and content type before saving PDF bytes.
  • Representative PDFs have been inspected for image quality, page breaks, clipping, fonts, links, and background graphics.

Frequently Asked Questions

Can an API convert a web page URL to PDF?

Yes, when the selected provider accepts URL input and its renderer can reach the page and its resources. Pages that require your local network, browser session, or an interactive login need a supported authentication or upload approach.

Should I embed images as data URIs?

Use data URIs only when the provider documents support and size limits. Otherwise, use reachable absolute URLs or the provider’s asset-upload or archive mechanism.

What is the safest way to handle a failed conversion?

Treat non-2xx responses as errors, preserve the provider’s diagnostic identifier, and retry only when the failure is transient and the request is safe to repeat.

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.

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