html_to_pdf
Convert HTML content to PDF with customizable margins, paper size, orientation, and headers/footers using the PDF.co MCP Server. Supports background printing, media type settings, and base64-encoded images.
Instructions
Input Schema
Name | Required | Description | Default |
---|---|---|---|
DoNotWaitFullLoad | No | false by default. Set to true to skip waiting for full load (like full video load etc. that may affect the total conversion time). (Optional) | |
api_key | No | PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional) | |
footer | No | User definable HTML for the footer to be applied on every page footer. (Optional) | |
header | No | User definable HTML for the header to be applied on every page header. (Optional) | |
html | Yes | Input 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. | |
httppassword | No | HTTP auth password if required to access source url. (Optional) | |
httpusername | No | HTTP auth user name if required to access source url. (Optional) | |
margins | No | Set 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) | |
mediaType | No | Uses 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) | |
name | No | File name for the generated output. (Optional) | |
orientation | No | Set to Portrait or Landscape. Portrait is set by default. (Optional) | |
paperSize | No | A4 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) | |
printBackground | No | true by default. Set to false to disable printing of background. (Optional) |