Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

html_to_pdf

Convert HTML code into PDF documents with customizable headers, footers, margins, and paper settings for print-ready output.

Instructions

Convert HTML to PDF.
Ref: https://developer.pdf.co/api/pdf-from-html/convert.md

The header and footer parameters can contain valid HTML markup with the following classes used to inject printing values into them:
- date: formatted print date
- title: document title
- url: document location
- pageNumber: current page number
- totalPages: total pages in the document
- img: tag is supported in both the header and footer parameter, provided that the src attribute is specified as a base64-encoded string.
For example, the following markup will generate Page N of NN page numbering:
```html
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
htmlYesInput HTML code to be converted. To convert the link to a PDF use the /pdf/convert/from/url endpoint instead. If it is a local file, just pass the file content as a string.
nameNoFile name for the generated output. (Optional)
footerNoUser definable HTML for the footer to be applied on every page footer. (Optional)
headerNoUser definable HTML for the header to be applied on every page header. (Optional)
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)
marginsNoSet to CSS style margins like 10px, 5mm, 5in for all sides or 5px 5px 5px 5px (the order of margins is top, right, bottom, left). (Optional)
profilesNoExtra engine options for this endpoint as a JSON object encoded in a string. The options differ per endpoint; see https://developer.pdf.co/api/profiles. (Optional)
mediaTypeNoUses print by default. Set to screen to convert HTML as it appears in a browser or print to convert as it appears for printing or none to set none as mediaType for CSS styles. (Optional)
paperSizeNoA4 is set by default. Can be Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6 or a custom size. Custom size can be set in px (pixels), mm or in (inches) with width and height separated by space like this: 200 300, 200px 300px, 200mm 300mm, 20cm 30cm or 6in 8in. (Optional)
expirationNoLifetime of the output link in minutes; the output file is deleted afterwards. API default is 60; the maximum depends on the plan. (Optional)
orientationNoSet to Portrait or Landscape. Portrait is set by default. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
httpusernameNoHTTP auth user name if required to access source url. (Optional)
printBackgroundNotrue by default. Set to false to disable printing of background. (Optional)
DoNotWaitFullLoadNofalse by default. Set to true to skip waiting for full load (like full video load etc. that may affect the total conversion time). (Optional)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.0.11
    • addedInput schema / properties / expiration
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Lifetime of the output link in minutes; the output file is deleted afterwards. API default is 60; the maximum depends on the plan. (Optional)",
      +  "title": "Expiration"
      +}
    • addedInput schema / properties / profiles
      Added value: +{
      +  "default": "",
      +  "description": "Extra engine options for this endpoint as a JSON object encoded in a string. The options differ per endpoint; see https://developer.pdf.co/api/profiles. (Optional)",
      +  "title": "Profiles",
      +  "type": "string"
      +}
  2. First observed

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry behavioral disclosure, and it does add real value by documenting the special header/footer classes (date, title, url, pageNumber, totalPages, base64 img) and an example. However, it omits other important behavior: whether the call is synchronous or job-based (siblings get_job_check/wait_job_completion suggest async jobs), what the response contains, and authorization/rate-limit expectations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in one sentence, followed by relevant header/footer documentation and a compact example. The external reference link adds little immediate value and the total length is slightly long, but every section except the bare URL earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the most complex parameter behavior (header/footer templating) well, and the schema covers all 15 parameters. But for a conversion tool with no output schema, the description does not explain what the tool returns (a link, a file, a job ID) or whether it runs synchronously, leaving an agent without critical end-to-end context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline would be 3, but the description meaningfully supplements the schema for the trickiest parameters. It explains the placeholder classes available in header and footer markup and provides a concrete example, which is not in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb and resource ('Convert HTML to PDF'), so the core action is unambiguous. It does not differentiate from sibling conversion tools such as document_to_pdf, webpage_to_pdf, or image_to_pdf, which is the main gap for this dimension.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives no guidance on when to choose this tool over the many sibling conversion endpoints, nor does it state prerequisites such as an API key or input restrictions. The only reference to an alternative is a URL to external documentation, not an in-context when-to-use rule.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.