ScreenshotNeo

BlogHow-to

How to Capture a Full-Page Website Screenshot with Html2Pdf.app

Html2Pdf.app generates PDFs, not raster screenshots. Learn its manual and API workflows, save a webpage as PDF, and convert it separately when you need an image.

By the ScreenshotNeo team4 October 20268 min read

Direct answer: Html2Pdf.app documents webpage-to-PDF conversion, not a direct full-page PNG or JPEG screenshot endpoint. You can give it a public URL or raw HTML and save the result as a PDF. If you need an image, convert that PDF to PNG or JPEG with a separate PDF-to-image tool; that extra conversion is not an Html2Pdf.app feature. Html2Pdf.app says its conversions run in headless Chromium. Read the official documentation.

1. Choose the right output

Use Html2Pdf.app when the deliverable can be a PDF: for example, a printable page, an archived document, or a PDF that another workflow will process. If the requirement is a single tall image or a viewport screenshot, the documented API does not establish that output mode. A PDF may paginate a long page; the documentation does not guarantee that arbitrary webpages become a single-page PDF.

Need Workflow
One-off PDF Use the online converter linked from the Html2Pdf.app homepage and enter a publicly reachable page URL.
Automated PDF POST JSON to the API from a trusted server and save the successful binary response as a PDF.
PNG or JPEG image Generate the PDF, then use a separate PDF-to-image converter. Choose an output resolution that keeps text legible.
Direct website screenshot image Use a screenshot capture workflow that returns an image, such as the ScreenshotNeo API shown below.

2. Convert a webpage manually

  1. Open the Html2Pdf.app homepage and follow its online converter link.
  2. Enter the publicly reachable webpage URL.
  3. Generate and download the PDF.
  4. Open the PDF and check page breaks, missing assets, and whether the full page content is present.
  5. If you need a raster image, convert the downloaded PDF with a separate PDF-to-image tool and inspect its dimensions and legibility.

This path avoids API integration for a one-off conversion. It does not make the PDF-to-image step part of Html2Pdf.app.

3. Generate a PDF with the API

The API uses an authenticated POST request to https://api.html2pdf.app/v1/generate. Send JSON with html set to either the page URL or raw HTML, and provide the API key in the X-API-Key header. Keep the key in a backend, server-side script, or trusted job; never embed it in browser JavaScript or public client code. On success, the response body is binary PDF data, so write it directly to a .pdf file instead of parsing it as text. See the vendor’s API documentation and cURL examples for current details.

cURL

curl --fail --silent --show-error \
  -X POST "https://api.html2pdf.app/v1/generate" \
  -H "X-API-Key: $HTML2PDF_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"html":"https://example.com"}' \
  --output page.pdf

Set HTML2PDF_API_KEY in the trusted shell or job environment before running this command. Replace the URL with the page to capture. --fail makes HTTP errors visible as command failures, while --output preserves the binary response as a file.

Python

import os
import requests

api_key = os.environ["HTML2PDF_API_KEY"]
response = requests.post(
    "https://api.html2pdf.app/v1/generate",
    headers={
        "X-API-Key": api_key,
        "Content-Type": "application/json",
    },
    json={"html": "https://example.com"},
    timeout=90,
)
response.raise_for_status()

with open("page.pdf", "wb") as pdf_file:
    pdf_file.write(response.content)

Install the dependency with python -m pip install requests. Binary mode (wb) matters: PDF bytes must not be decoded as text.

Node.js

const apiKey = process.env.HTML2PDF_API_KEY;
if (!apiKey) throw new Error("Set HTML2PDF_API_KEY first");

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

if (!response.ok) {
  throw new Error(`Html2Pdf.app returned HTTP ${response.status}: ${await response.text()}`);
}

const pdf = Buffer.from(await response.arrayBuffer());
await import("node:fs/promises").then(({ writeFile }) => writeFile("page.pdf", pdf));

This uses the built-in fetch available in current Node.js releases. Keep the API key in the server process environment, and do not return it to a browser client.

4. Configure page size, dimensions, and rendering wait

The documented API accepts width and height in pixels for a custom canvas; provide them together. Documented paper formats include A0–A6, Letter, Legal, Tabloid, and Ledger. Use the official parameter reference for exact accepted request fields and formats, since API details may change.

For pages that rely on JavaScript or delayed resources, the API documents waitFor from 0 to 10 seconds. Increase it only as much as needed for the page’s rendering behavior. Waiting cannot make a blocked resource reachable, and asynchronous page content can still be timing-sensitive.

Before settling on dimensions or page format, render representative pages and inspect the PDF. The available documentation does not promise that every long webpage will fit on one page. If a single-page image is the actual need, a separate PDF conversion may create a very tall raster; verify that the result remains readable and is supported by the image tool.

5. Use asynchronous callbacks for jobs

The documentation also describes an asynchronous callback mode. The service posts a base64-encoded PDF to your callback endpoint. Use HTTPS, validate that an incoming callback belongs to the expected job using the documented mechanism, and make processing idempotent so a repeated delivery cannot create duplicate downstream work. Decode the base64 payload back to bytes before writing or processing the PDF. Consult the official callback documentation for the current request shape and authentication details.

6. Turn the PDF into an image

Html2Pdf.app’s documented output is PDF. For PNG or JPEG, use a separate PDF renderer or conversion utility after generation:

  1. Choose the page or pages to rasterize. A multi-page PDF may require one image per page or a separate stitching step.
  2. Choose a resolution appropriate to the use: higher resolution improves small text detail but increases file size and processing requirements.
  3. For a full-page image, ensure the PDF itself contains all the content you need. A page break cannot be undone by rasterizing it.
  4. Check image dimensions, clipping, text legibility, and color appearance in the resulting file.

The converter choice depends on your environment and output requirements. The research for this guide does not establish specific third-party conversion products, limits, or performance claims.

7. Rendering factors and edge cases

  • Public reachability: the renderer must be able to reach the target URL. A page available only on a private network or behind an interactive login may not render as expected.
  • External assets: CSS, images, and fonts must also be reachable to the rendering service. A page can load while its assets fail.
  • JavaScript timing: scripts may populate content after initial navigation. Use the documented waitFor setting where appropriate, then check the output.
  • CSS media: the selected media mode can affect styles and layout. Verify the rendered result against the intended use.
  • Fonts: unavailable fonts can change line wrapping and page breaks. Confirm fonts are accessible and inspect the output.
  • Long pages: PDF page breaks and custom dimensions affect whether content appears as expected. No universal single-page guarantee is documented.
  • Raw HTML: when sending HTML instead of a URL, make sure its linked resources can be fetched by the renderer, or include the resources in a way supported by the service.

8. Troubleshooting

Symptom Likely cause What to do
HTTP authentication error The API key is missing, invalid, or sent under the wrong header. Send the key in X-API-Key as documented, verify the server-side secret, and avoid exposing it in client code.
Response is an error page or request fails The request body is malformed, the URL is invalid, or the API returned an HTTP error. Check JSON syntax and the target URL. Inspect the HTTP status and error response before treating the result as a PDF.
PDF file is unreadable Binary output was decoded, or an error response was saved with a PDF extension. Check the HTTP status first and write successful response bytes directly to disk.
Blank or incomplete page JavaScript content had not rendered, or the page/resource was inaccessible. Check public reachability of the page and assets; adjust waitFor within the documented 0–10 second range and render again.
Missing styles, images, or fonts External resources are blocked, private, or otherwise unreachable from the rendering service. Make the resources publicly reachable or use a supported self-contained HTML approach; verify each resource independently.
Unexpected page breaks The selected page format or dimensions do not match the page layout, or the page is longer than expected. Test the documented page formats and paired custom dimensions. Inspect the PDF before rasterizing it.
Callback processing duplicates work The receiver is not idempotent or handles repeated delivery as a new job. Use an HTTPS callback and make downstream handling safe to repeat, as the vendor documentation recommends.

9. Performance, reliability, and cost considerations

Conversion time and output quality depend on page behavior, JavaScript timing, CSS media, fonts, and reachable resources. Avoid assuming that a fixed wait or a successful HTTP response means the page is visually complete; inspect representative output and handle errors explicitly. For batch work, use bounded concurrency and retry only transient failures according to your job policy, rather than flooding the service with immediate retries.

The homepage advertises plans and usage figures that can change. Check the live Html2Pdf.app homepage for current pricing and limits before budgeting; this guide does not treat vendor-advertised figures as independent benchmarks. Factor in the separate PDF-to-image conversion step if your final deliverable is PNG or JPEG.

Or skip the browser setup

If the deliverable is a raster screenshot, ScreenshotNeo returns an image directly from one GET request. It is a website screenshot API and MCP server. The service accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. AI agents can use its MCP tools: take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. See the ScreenshotNeo API documentation.

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

Replace the target URL with your page. The response can be PNG, JPEG, WebP, or PDF, and the API also supports full-page capture, viewport and device settings, custom CSS and JavaScript, waits, and other capture controls. Learn about ScreenshotNeo or sign up free for 1,000 screenshots a month with no card.

FAQ

Can Html2Pdf.app return a full-page PNG directly?

The reviewed official documentation establishes PDF generation, not a direct PNG or JPEG screenshot endpoint. Convert the PDF separately if you need a raster file.

Does a long webpage always become one PDF page?

No such guarantee appears in the documentation. Check page breaks and dimensions on the actual output.

Can I call the API from browser JavaScript?

Keep the API key on a trusted server or job. Putting it in browser code exposes the credential to visitors.

What if I need a screenshot inside an AI agent workflow?

ScreenshotNeo provides an MCP server with screenshot, page-info, and PDF capture tools; its documentation explains the integration.