HTML/URL to PDF

Convert HTML or public webpages into downloadable PDF files

Efficient PDF Generation Provides Permanent Links

API features

HTML and webpage input

Create a PDF from application-generated HTML or from a complete public HTTP(S) webpage URL.

Portrait or landscape A4 output

Choose the page orientation that best fits reports, tables, forms, and printable records.

Styled document rendering

Preserve supported HTML, CSS, and page backgrounds for presentation-ready output.

Downloadable HTTPS file

Receive a public PDF URL that applications can download, store, share, or attach to another workflow.

Business document generation

Produce invoices, receipts, statements, reports, confirmations, and approval documents.

Webpage archiving

Capture public pages as fixed-layout PDF records for review, compliance, and historical reference.

API Document

HTTP Protocol:HTTPS

HTTP Method:POST

HTTP Endpoint:https://api.gugudata.io/v1/imagerecognition/html2pdf

Response Type:application/json; charset=utf-8

DEMO Endpoint:https://api.gugudata.io/v1/imagerecognition/html2pdf/demo

Live Demo:Try Interactive Demo

Postman Collection:Run in Postman

API Request Parameters

NameTypeIs RequiredDefault ValueRemark
appkey string trueYOUR_APPKEY API key used to authenticate the request.
type string truehtml Input type: html for raw HTML or url for a public webpage.
content string true<html><body><h1>Quarterly report</h1></body></html> Raw HTML up to 5 MiB, or a complete public HTTP or HTTPS URL up to 2,048 characters.
landscape integer false0 Set to 1 for landscape orientation or 0 for portrait orientation.

API Response Parameters

NameTypeRemark
pdfPath string Public HTTPS URL of the generated PDF file.

API Response Status Codes

Status CodeExplanation of Status CodeRemarks
200Request processed successfully.Some endpoints expose a separate application-level status field in the response body, such as `dataStatus.statusCode`.
400Invalid request parameters or request format.Check required fields, data types, and request body format.
401Missing or unknown application key.Provide a valid `appkey` with the request.
403The application key is recognized but access is not allowed.The key may be expired, inactive, or not permitted for the requested API.
429Request rate or trial usage limit exceeded.Reduce request frequency and retry with backoff. If a trial allowance is exhausted, check Trial Keys for remaining requests and subscribe to continue.
500Internal service error.Retry later or contact support if the error persists.
503Upstream service unavailable.Retry later; the requested upstream dependency is temporarily unavailable.

Remote MCP

AI client access

Use this API through GuGuData Remote MCP

Connect your AI client once, authorize in the browser, and the client can use the GuGuData API tools available to your account. You do not need to paste an appkey into the MCP client.

Endpoint https://mcp.gugudata.io/mcp
Open MCP Guide
Generic MCP configuration
{
  "mcpServers": {
    "gugudata": {
      "url": "https://mcp.gugudata.io/mcp",
      "transportType": "streamable-http"
    }
  }
}

Code Snippets

HTML to PDF

Submit HTML for a report or a public URL, then save the PDF returned by the API.

Input and coverage: HTML inputs support up to 5 MiB; URL inputs up to 2048 characters. Keep access to your input and save the returned PDF.

Example request

Replace YOUR_APPKEY with your own API key. This request uses the normal API endpoint.

curl --fail-with-body 'https://api.gugudata.io/v1/imagerecognition/html2pdf?appkey=YOUR_APPKEY' \
  --request POST \
  --header 'Content-Type: application/json' \
  --data '{"type": "html", "content": "<html><body><h1>Quarterly report</h1><p>Prepared for review.</p></body></html>", "landscape": 0}'
View sample Demo response

This is a fixed Demo sample, shortened for readability. It is not the response to your example request. Your results depend on the input and dataset. File URLs are temporary and have been removed.

{
  "dataStatus": {
    "statusCode": 200,
    "status": "SUCCESS",
    "statusDescription": "successfully",
    "dataTotalCount": 1
  },
  "data": {
    "pdfPath": "<temporary PDF URL>"
  }
}

Frequently asked questions

Can I convert either HTML or a webpage URL to PDF?

Yes. Set type to html and put your HTML in content, or set type to url and provide a public HTTP or HTTPS webpage URL. The output is a downloadable PDF.

How do I create a landscape PDF?

Set landscape to 1 for landscape orientation, or 0 for portrait. Test a representative page to confirm that the content fits the chosen orientation before using it in an automated export.

What are the documented input size limits?

Raw HTML can be up to 5 MiB. A webpage URL can be up to 2,048 characters and must use public HTTP or HTTPS. Check the input type before applying the corresponding limit.

Does the API return PDF bytes or a download link?

The documented success result includes pdfPath, an HTTPS URL for the generated file. Download the PDF into your own storage if you need to retain or distribute a copy.

Will a PDF look exactly like the interactive webpage?

Do not assume an exact match. A PDF is a fixed-page output, while a webpage can depend on responsive layout, fonts, and interactive content. Test your own HTML and styles with the Demo before relying on the layout.

What does the 5 requests per second limit mean?

It is a request-rate limit, not a concurrency allowance. Keep your request rate at or below 5 per second. If the service returns a rate-limit response, reduce the frequency and retry with backoff.

Is total paid usage limited?

There is no total request cap during an active paid subscription and no usage-based overage charge.

How does the free trial work?

Each account can receive a limited trial key. Requests are shared across APIs in the same category. Check Trial Keys for the exact allowance and remaining requests.

How do renewal and cancellation work?

The plan renews annually until canceled. Manage or cancel the renewal from Dashboard → Orders & Billing. Access continues through the paid period after cancellation. See the Terms of Service for the current refund policy. If the billing portal is unavailable, contact support.

Technical support

Need help choosing an API or getting started?

support@gugudata.io

Service terms

Read our service terms and privacy policy before subscribing.