Link Search Menu Expand Document

PDF from HTML template (Mustache or HandleBars style)

Description: Creates PDF from HTML template. POST request.

Status Errors

CodeDescription
200The request has succeeded
400bad input parameters
401unauthorized
403not enough credits
405Timeout error. To process large documents or files please use asynchronous mode ( set async parameter to true) and then check the status using /job/check endpoint. If file contains many pages then specify a page range using pages parameter. The number of pages of the document can be obtained using the endpoint /pdf/info

PDF.co supports Handlebars & Mustache HTML templates. It works like this: HTML or URL to HTML contains HTML code with special macros like `` inside. To put data for to be replaced in the template use templateData property with the string representation of JSON data object inside (use JSON.stringify(object) or similar to generate string from JSON).

So if you are setting templateData property to JSON like this { invoice: { company: \"ACME Company\"}} then `` inside HTML template is getting replaced with ACME Company.

For more information about Handlebars & Mustache templates please visit https://handlebarsjs.com/.

Available Methods

Go To Samples

[POST] /pdf/convert/from/html (using simple inline HTML template)

You can generate PDF from HTML template. Just pass HTML template with Mustache or Handlebars variables as input.

  • html required. HTML template with Mustache and Handlebars template. If you need to convert from url then please use /pdf/convert/from/url endpoint instead.
  • margins optional. 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).
  • orientation optional. set to Portrait or Landscape. Portrait by default.
  • paperSize optional. Letter 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.
  • printBackground optional. true by default. Set to false to disable printing of background.
  • header optional. Set to HTML for header to be applied on every page at the header.
  • footer optional. Set to HTML for footer to be applied on every page at the bottom.
  • async optional. Set to true to run as async job in background (recommended for heavy documents).
  • templateData optional. Set to string with JSON data for template if your HTML is a template (Handlebars & Mustache style). And you should set templateData param to the escaped string (use JSON.stringify(object) or similar)
  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/convert/from/html

Query parameters

No query parameters accepted.

Body payload

{
    "html": "Sample template: <strong></strong> and <strong></strong>",
    "name": "newDocument.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\"variable1\": \"Hello from variable1\", \"variable2\": \"Hello from variable 2\"}"
}

Example responses

JSON POST (simple template) /pdf/convert/from/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/3f10116dafe4498aa0c498ac1735fb76/newDocument.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "newDocument.pdf",
    "remainingCredits": 60065
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/from/html' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "html": "Sample template: <strong></strong> and <strong></strong>",
    "name": "newDocument.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\"variable1\": \"Hello from variable1\", \"variable2\": \"Hello from variable 2\"}"
}'

[POST] /pdf/convert/from/url (invoice template 1)

Generate PDF from HTML templates (Mustache and Handlebars template styles are supported). Input Parameters

  • url required. Url to HTML template. Mustache and Handlebars templates are supported. You can pass link to file from Google Drive, Dropbox or another online file service that can generate shareable links. You can also use built-in PDF.co cloud storage located at https://app.pdf.co/files or upload your file as temporary file right before making this API call (see Upload and Manage Files section for more details on uploading files via API).
  • margins optional. 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).
  • paperSize optional. Letter 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.
  • orientation optional. set to Portrait or Landscape. Portrait by default.
  • printBackground optional. true by default. Set to false to disable printing of background.
  • header optional. Set to HTML for header to be applied on every page at the header.
  • footer optional. Set to HTML for footer to be applied on every page at the bottom.
  • async optional. Set to true to run as async job in background (recommended for heavy documents).
  • templateData optional. Set to string with JSON data for template if your HTML is a template (Handlebars & Mustache style).

Example of JSON for template data:

{
        "invoice": {
            "id": "0021",
            "date": "August 29, 2041",
            "dateDue": "September 29, 2041"
        },
        "issuer": {
            "name": "Sarah Connor",
            "company": "T-800 Research Lab",
            "address": "435 South La Fayette Park Place, Los Angeles, CA 90057",
            "website": "www.example.com",
            "email": "info@example.com"
        },
        "client": {
            "name": "Cyberdyne Systems",
            "company": "Cyberdyne Systems",
            "address": "18144 El Camino Real, Sunnyvale, California",
            "website": "www.example.com",
            "email": "sales@example.com"
        },
        "items": [
            {
                "name": "T-800 Prototype Research",
                "price": "$1000.00"
            },
            {
                "name": "T-800 Cloud Sync Setup",
                "price": "$300.00"
            },
            {
                "name": "Skynet Domain Setup",
                "price": "$50.00"
            },
            {
                "name": "T-800 OS License",
                "price": "$350.00"
            },
            {
                "name": "T-800 Vision Testing",
                "price": "$150.00"
            },
        ],
        "discount": "$100.00%",
        "tax": "$126.88 (7.5%)",
        "total": "$1876.88",
        "paid": true,
        "note": "Thank you for your business with us.",
        "primaryColor": "#E4135A",
        "secondaryColor": "#00538B",
        "textColor": "#3F4254"
    }

And you should set templateData to the escaped version (use JSON.stringify(object) or similar)

  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/convert/from/url

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/cloudapi-templates/template-invoice-1.html",
    "name": "newInvoice.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\r\n        \"invoice\": {\r\n            \"id\": \"0021\",\r\n            \"date\": \"August 29, 2041\",\r\n            \"dateDue\": \"September 29, 2041\"\r\n        },\r\n        \"issuer\": {\r\n            \"name\": \"Sarah Connor\",\r\n            \"company\": \"T-800 Research Lab\",\r\n            \"address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"info@example.com\"\r\n        },\r\n        \"client\": {\r\n            \"name\": \"Cyberdyne Systems\",\r\n            \"company\": \"Cyberdyne Systems\",\r\n            \"address\": \"18144 El Camino Real, Sunnyvale, California\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"sales@example.com\"\r\n        },\r\n        \"items\": [\r\n            {\r\n                \"name\": \"T-800 Prototype Research\",\r\n                \"price\": \"$1000.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Cloud Sync Setup\",\r\n                \"price\": \"$300.00\"\r\n            },\r\n            {\r\n                \"name\": \"Skynet Domain Setup\",\r\n                \"price\": \"$50.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 OS License\",\r\n                \"price\": \"$350.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Vision Testing\",\r\n                \"price\": \"$150.00\"\r\n            },\r\n        ],\r\n        \"discount\": \"$100.00\",\r\n        \"tax\": \"$126.88 (7.5%)\",\r\n        \"total\": \"$1876.88\",\r\n        \"paid\": true,\r\n        \"note\": \"Thank you for your business with us.\",\r\n        \"primaryColor\": \"#E4135A\",\r\n        \"secondaryColor\": \"#00538B\",\r\n        \"textColor\": \"#3F4254\"\r\n    }"
}

Example responses

JSON POST (sample invoice template 1) /pdf/convert/from/html
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/81329c3acdbe430092c76f1cec8e0fa8/newInvoice.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "newInvoice.pdf",
    "remainingCredits": 60074
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/from/url' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/cloudapi-templates/template-invoice-1.html",
    "name": "newInvoice.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\r\n        \"invoice\": {\r\n            \"id\": \"0021\",\r\n            \"date\": \"August 29, 2041\",\r\n            \"dateDue\": \"September 29, 2041\"\r\n        },\r\n        \"issuer\": {\r\n            \"name\": \"Sarah Connor\",\r\n            \"company\": \"T-800 Research Lab\",\r\n            \"address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"info@example.com\"\r\n        },\r\n        \"client\": {\r\n            \"name\": \"Cyberdyne Systems\",\r\n            \"company\": \"Cyberdyne Systems\",\r\n            \"address\": \"18144 El Camino Real, Sunnyvale, California\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"sales@example.com\"\r\n        },\r\n        \"items\": [\r\n            {\r\n                \"name\": \"T-800 Prototype Research\",\r\n                \"price\": \"$1000.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Cloud Sync Setup\",\r\n                \"price\": \"$300.00\"\r\n            },\r\n            {\r\n                \"name\": \"Skynet Domain Setup\",\r\n                \"price\": \"$50.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 OS License\",\r\n                \"price\": \"$350.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Vision Testing\",\r\n                \"price\": \"$150.00\"\r\n            },\r\n        ],\r\n        \"discount\": \"$100.00\",\r\n        \"tax\": \"$126.88 (7.5%)\",\r\n        \"total\": \"$1876.88\",\r\n        \"paid\": true,\r\n        \"note\": \"Thank you for your business with us.\",\r\n        \"primaryColor\": \"#E4135A\",\r\n        \"secondaryColor\": \"#00538B\",\r\n        \"textColor\": \"#3F4254\"\r\n    }"
}'

[POST] /pdf/convert/from/url (invoice template 2)

Generate PDF from HTML templates (Mustache and Handlebars template styles are supported). Input Parameters

  • url required. Url to HTML template. Mustache and Handlebars templates are supported. You can pass link to file from Google Drive, Dropbox or another online file service that can generate shareable links. You can also use built-in PDF.co cloud storage located at https://app.pdf.co/files or upload your file as temporary file right before making this API call (see Upload and Manage Files section for more details on uploading files via API).
  • margins optional. 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).
  • paperSize optional. Letter 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.
  • orientation optional. set to Portrait or Landscape. Portrait by default.
  • printBackground optional. true by default. Set to false to disable printing of background.
  • header optional. Set to HTML for header to be applied on every page at the header.
  • footer optional. Set to HTML for footer to be applied on every page at the bottom.
  • async optional. Set to true to run as async job in background (recommended for heavy documents).
  • templateData optional. Set to string with JSON data for template if your HTML is a template (Handlebars & Mustache style).

Example of JSON for template data:

{
        "invoice": {
            "id": "0021",
            "date": "August 29, 2041",
            "dateDue": "September 29, 2041"
        },
        "issuer": {
            "name": "Sarah Connor",
            "company": "T-800 Research Lab",
            "address": "435 South La Fayette Park Place, Los Angeles, CA 90057",
            "website": "www.example.com",
            "email": "info@example.com"
        },
        "client": {
            "name": "Cyberdyne Systems",
            "company": "Cyberdyne Systems",
            "address": "18144 El Camino Real, Sunnyvale, California",
            "website": "www.example.com",
            "email": "sales@example.com"
        },
        "items": [
            {
                "name": "T-800 Prototype Research",
                "price": "$1000.00"
            },
            {
                "name": "T-800 Cloud Sync Setup",
                "price": "$300.00"
            },
            {
                "name": "Skynet Domain Setup",
                "price": "$50.00"
            },
            {
                "name": "T-800 OS License",
                "price": "$350.00"
            },
            {
                "name": "T-800 Vision Testing",
                "price": "$150.00"
            },
        ],
        "discount": "$100.00%",
        "tax": "$126.88 (7.5%)",
        "total": "$1876.88",
        "paid": true,
        "note": "Thank you for your business with us.",
        "primaryColor": "#E4135A",
        "secondaryColor": "#00538B",
        "textColor": "#3F4254"
    }

And you should set templateData to the escaped version (use JSON.stringify(object) or similar)

  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/convert/from/url

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/cloudapi-templates/template-invoice-2.html",
    "name": "newInvoice.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\r\n        \"invoice\": {\r\n            \"id\": \"0021\",\r\n            \"date\": \"August 29, 2041\",\r\n            \"dateDue\": \"September 29, 2041\"\r\n        },\r\n        \"issuer\": {\r\n            \"name\": \"Sarah Connor\",\r\n            \"company\": \"T-800 Research Lab\",\r\n            \"address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"info@example.com\"\r\n        },\r\n        \"client\": {\r\n            \"name\": \"Cyberdyne Systems\",\r\n            \"company\": \"Cyberdyne Systems\",\r\n            \"address\": \"18144 El Camino Real, Sunnyvale, California\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"sales@example.com\"\r\n        },\r\n        \"items\": [\r\n            {\r\n                \"name\": \"T-800 Prototype Research\",\r\n                \"price\": \"$1000.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Cloud Sync Setup\",\r\n                \"price\": \"$300.00\"\r\n            },\r\n            {\r\n                \"name\": \"Skynet Domain Setup\",\r\n                \"price\": \"$50.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 OS License\",\r\n                \"price\": \"$350.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Vision Testing\",\r\n                \"price\": \"$150.00\"\r\n            },\r\n        ],\r\n        \"discount\": \"$100.00%\",\r\n        \"tax\": \"$126.88 (7.5%)\",\r\n        \"total\": \"$1876.88\",\r\n        \"paid\": true,\r\n        \"note\": \"Thank you for your business with us.\",\r\n        \"primaryColor\": \"#E4135A\",\r\n        \"secondaryColor\": \"#00538B\",\r\n        \"textColor\": \"#3F4254\"\r\n    }"
}

Example responses

JSON POST (sample invoice template 2) /pdf/convert/from/url
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/3296ac4a8121401cad7b8a38a8864b53/newInvoice.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "newInvoice.pdf",
    "remainingCredits": 60071
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/from/url' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/cloudapi-templates/template-invoice-2.html",
    "name": "newInvoice.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\r\n        \"invoice\": {\r\n            \"id\": \"0021\",\r\n            \"date\": \"August 29, 2041\",\r\n            \"dateDue\": \"September 29, 2041\"\r\n        },\r\n        \"issuer\": {\r\n            \"name\": \"Sarah Connor\",\r\n            \"company\": \"T-800 Research Lab\",\r\n            \"address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"info@example.com\"\r\n        },\r\n        \"client\": {\r\n            \"name\": \"Cyberdyne Systems\",\r\n            \"company\": \"Cyberdyne Systems\",\r\n            \"address\": \"18144 El Camino Real, Sunnyvale, California\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"sales@example.com\"\r\n        },\r\n        \"items\": [\r\n            {\r\n                \"name\": \"T-800 Prototype Research\",\r\n                \"price\": \"$1000.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Cloud Sync Setup\",\r\n                \"price\": \"$300.00\"\r\n            },\r\n            {\r\n                \"name\": \"Skynet Domain Setup\",\r\n                \"price\": \"$50.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 OS License\",\r\n                \"price\": \"$350.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Vision Testing\",\r\n                \"price\": \"$150.00\"\r\n            },\r\n        ],\r\n        \"discount\": \"$100.00%\",\r\n        \"tax\": \"$126.88 (7.5%)\",\r\n        \"total\": \"$1876.88\",\r\n        \"paid\": true,\r\n        \"note\": \"Thank you for your business with us.\",\r\n        \"primaryColor\": \"#E4135A\",\r\n        \"secondaryColor\": \"#00538B\",\r\n        \"textColor\": \"#3F4254\"\r\n    }"
}'

[POST] /pdf/convert/from/url (invoice template 3)

Generate PDF from HTML templates (Mustache and Handlebars template styles are supported). Input Parameters

  • url required. Url to HTML template. Mustache and Handlebars templates are supported. You can pass link to file from Google Drive, Dropbox or another online file service that can generate shareable links. You can also use built-in PDF.co cloud storage located at https://app.pdf.co/files or upload your file as temporary file right before making this API call (see Upload and Manage Files section for more details on uploading files via API).
  • margins optional. 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).
  • paperSize optional. Letter 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.
  • orientation optional. set to Portrait or Landscape. Portrait by default.
  • printBackground optional. true by default. Set to false to disable printing of background.
  • header optional. Set to HTML for header to be applied on every page at the header.
  • footer optional. Set to HTML for footer to be applied on every page at the bottom.
  • async optional. Set to true to run as async job in background (recommended for heavy documents).
  • templateData optional. Set to string with JSON data for template if your HTML is a template (Handlebars & Mustache style).

Example of JSON for template data:

{
        "invoice": {
            "id": "0021",
            "date": "August 29, 2041",
            "dateDue": "September 29, 2041"
        },
        "issuer": {
            "name": "Sarah Connor",
            "company": "T-800 Research Lab",
            "address": "435 South La Fayette Park Place, Los Angeles, CA 90057",
            "website": "www.example.com",
            "email": "info@example.com"
        },
        "client": {
            "name": "Cyberdyne Systems",
            "company": "Cyberdyne Systems",
            "address": "18144 El Camino Real, Sunnyvale, California",
            "website": "www.example.com",
            "email": "sales@example.com"
        },
        "items": [
            {
                "name": "T-800 Prototype Research",
                "price": "$1000.00"
            },
            {
                "name": "T-800 Cloud Sync Setup",
                "price": "$300.00"
            },
            {
                "name": "Skynet Domain Setup",
                "price": "$50.00"
            },
            {
                "name": "T-800 OS License",
                "price": "$350.00"
            },
            {
                "name": "T-800 Vision Testing",
                "price": "$150.00"
            },
        ],
        "discount": "$100.00%",
        "tax": "$126.88 (7.5%)",
        "total": "$1876.88",
        "paid": true,
        "note": "Thank you for your business with us.",
        "primaryColor": "#E4135A",
        "secondaryColor": "#00538B",
        "textColor": "#3F4254"
    }

And you should set templateData to the escaped version (use JSON.stringify(object) or similar)

  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/convert/from/url

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/cloudapi-templates/template-invoice-3.html",
    "name": "newInvoice.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\r\n        \"invoice\": {\r\n            \"id\": \"0021\",\r\n            \"date\": \"August 29, 2041\",\r\n            \"dateDue\": \"September 29, 2041\"\r\n        },\r\n        \"issuer\": {\r\n            \"name\": \"Sarah Connor\",\r\n            \"company\": \"T-800 Research Lab\",\r\n            \"address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"info@example.com\"\r\n        },\r\n        \"client\": {\r\n            \"name\": \"Cyberdyne Systems\",\r\n            \"company\": \"Cyberdyne Systems\",\r\n            \"address\": \"18144 El Camino Real, Sunnyvale, California\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"sales@example.com\"\r\n        },\r\n        \"items\": [\r\n            {\r\n                \"name\": \"T-800 Prototype Research\",\r\n                \"price\": \"$1000.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Cloud Sync Setup\",\r\n                \"price\": \"$300.00\"\r\n            },\r\n            {\r\n                \"name\": \"Skynet Domain Setup\",\r\n                \"price\": \"$50.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 OS License\",\r\n                \"price\": \"$350.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Vision Testing\",\r\n                \"price\": \"$150.00\"\r\n            },\r\n        ],\r\n        \"discount\": \"$100.00%\",\r\n        \"tax\": \"$126.88 (7.5%)\",\r\n        \"total\": \"$1876.88\",\r\n        \"paid\": true,\r\n        \"note\": \"Thank you for your business with us.\",\r\n        \"primaryColor\": \"#E4135A\",\r\n        \"secondaryColor\": \"#00538B\",\r\n        \"textColor\": \"#3F4254\"\r\n    }"
}

Example responses

/pdf/convert/from/url (invoice template 3)
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/62b81093f6e74a78ae0487c29e087fb6/newInvoice.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "newInvoice.pdf",
    "remainingCredits": 616222,
    "credits": 21
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/convert/from/url' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/cloudapi-templates/template-invoice-3.html",
    "name": "newInvoice.pdf",
    "margins": "5px 5px 5px 5px",
    "paperSize": "Letter",
    "orientation": "Portrait",
    "printBackground": true,
    "header": "",
    "footer": "",
    "async": false,
    "encrypt": false,
    "templateData": "{\r\n        \"invoice\": {\r\n            \"id\": \"0021\",\r\n            \"date\": \"August 29, 2041\",\r\n            \"dateDue\": \"September 29, 2041\"\r\n        },\r\n        \"issuer\": {\r\n            \"name\": \"Sarah Connor\",\r\n            \"company\": \"T-800 Research Lab\",\r\n            \"address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"info@example.com\"\r\n        },\r\n        \"client\": {\r\n            \"name\": \"Cyberdyne Systems\",\r\n            \"company\": \"Cyberdyne Systems\",\r\n            \"address\": \"18144 El Camino Real, Sunnyvale, California\",\r\n            \"website\": \"www.example.com\",\r\n            \"email\": \"sales@example.com\"\r\n        },\r\n        \"items\": [\r\n            {\r\n                \"name\": \"T-800 Prototype Research\",\r\n                \"price\": \"$1000.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Cloud Sync Setup\",\r\n                \"price\": \"$300.00\"\r\n            },\r\n            {\r\n                \"name\": \"Skynet Domain Setup\",\r\n                \"price\": \"$50.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 OS License\",\r\n                \"price\": \"$350.00\"\r\n            },\r\n            {\r\n                \"name\": \"T-800 Vision Testing\",\r\n                \"price\": \"$150.00\"\r\n            },\r\n        ],\r\n        \"discount\": \"$100.00%\",\r\n        \"tax\": \"$126.88 (7.5%)\",\r\n        \"total\": \"$1876.88\",\r\n        \"paid\": true,\r\n        \"note\": \"Thank you for your business with us.\",\r\n        \"primaryColor\": \"#E4135A\",\r\n        \"secondaryColor\": \"#00538B\",\r\n        \"textColor\": \"#3F4254\"\r\n    }"
}'

Samples