PDF from HTML Template
Description: Creates PDF from HTML template. POST
request.
Status Errors
Code | Description |
---|---|
200 | The request has succeeded |
400 | bad input parameters |
401 | unauthorized |
403 | not enough credits |
405 | Timeout 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 {{Mustache}}
style HTML templates. For example, you can set templateData
property to JSON like this { invoice: { company: \"ACME Company\"}}
and {{invoice.company}}
inside template will be replaced with ACME Company
.
For more information about Handlebars & Mustache templates please visit https://handlebarsjs.com/.
Available Methods
- [POST] /pdf/convert/from/html (json input)
- [POST] /pdf/convert/from/html (csv input)
- [POST] /pdf/convert/from/html (advanced template with auto calc)
- [POST] /pdf/convert/from/html (multi page invoice with qr code and auto calc)
- [GET] /templates/html
- [GET] /templates/html/:id
[POST] /pdf/convert/from/html (json input)
Automate and scale PDF generation using built-in PDF.co HTML templates. API loads data from templateData
parameter and uses this data to inject data into your html template.
Create, test and manage your HTML templates here
Templates use {{Mustache}}
and Handlebars
templating syntax. You just need to insert macros surrounded by double brackets like {{
and }}
.
Some Examples of macro inside html template:
{{variable1}}
will be replaced withtest
if you settemplateData
to{ "variable1": "test"}
{{object1.variable1}}
will be replaced withtest
if you settemplateData
to{ "object1": { "variable1": "test"} }
- simple conditions are also supported. For example:
{{#if paid}} invoice was paid {{/if}}
will showinvoice was paid
whentemplateData
is set to{ "paid": true }
Attributes |
---|
templateId required Set to the ID of your HTML template. You can find and copy ID at HTML templates section in the app. |
templateData required Set it to a string with input JSON data (recommended) or from CSV data. |
Sample JSON input:
"templateData": "{ 'paid': true, 'invoice_id': '0002', 'total': '$999.99' }"
NOTE: If you use JSON as input then make sure to escape it first (with JSON.stringify(dataObject)
in JS). Escaping is when every "
is replaced with \"
(most programming languages are doing it automatically though.
Example with "
be escaped as \"
then:
"templateData": "{ \"paid\": true, \"invoice_id\": \"0002\", \"total\": \"$999.99\" }"
You can also use simple CSV as input:
"templateData": "paid,invoice_id,total
true,0002,$999.99"
Attributes |
---|
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. |
mediaType optional Uses print by default. Set to screen to convert HTML as it appears in a browser; print to convert as it appears for printing; none sets media type to none . |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configuration for fine-tuning and extra options, The input must be in string format. Explore PDF.co knowledgebase for profile examples. |
header optional Set to HTML for the header to be applied on every page at the header. |
footer optional Set to HTML for the footer to be applied on every page at the bottom. |
The header
and footer
params should 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
For example, the following markup will generate Page N of NN
page numbering:
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>
Sample advanced header and footer:
"header": "<div style='width:100%'><span style='font-size:10px;margin-left:20px;width:50%;float:left'>LEFT SUBHEADER</span><span style='font-size:8px;width:30%;float:right'>RIGHT SUBHEADER</span></div>",
"footer": "<div style='width:100%;text-align:right'><span style='font-size:10px;margin-right:20px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span></div>"
- Method: POST
- URL: /v1/pdf/convert/from/html
Query parameters
No query parameters accepted.
Body payload
{
"templateId": 1,
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"invoice_id\": \"0021\",\"invoice_date\": \"August 29, 2041\",\"invoice_dateDue\": \"September 29, 2041\",\"issuer_name\": \"Sarah Connor\",\"issuer_company\": \"T-800 Research Lab\",\"issuer_address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\"issuer_website\": \"www.example.com\",\"issuer_email\": \"info@example.com\",\"client_name\": \"Cyberdyne Systems\",\"client_company\": \"Cyberdyne Systems\",\"client_address\": \"18144 El Camino Real, Sunnyvale, California\",\"client_email\": \"sales@example.com\",\"items\": [ { \"name\": \"T-800 Prototype Research\", \"price\": 1000.00 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 300.00 } ],\"discount\": 100,\"tax\": 87,\"total\": 1287,\"note\": \"Thank you for your support of advanced robotics.\"}"
}
Example responses
/pdf/convert/from/html (json input)
{
"url": "https://pdf-temp-files.s3.amazonaws.com/a2cd107f504740a5bddec4cb8dd3f76a/newDocument.pdf",
"pageCount": 1,
"error": false,
"status": 200,
"name": "newDocument.pdf",
"remainingCredits": 99072306,
"credits": 9
}
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 '{
"templateId": 1,
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"invoice_id\": \"0021\",\"invoice_date\": \"August 29, 2041\",\"invoice_dateDue\": \"September 29, 2041\",\"issuer_name\": \"Sarah Connor\",\"issuer_company\": \"T-800 Research Lab\",\"issuer_address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\"issuer_website\": \"www.example.com\",\"issuer_email\": \"info@example.com\",\"client_name\": \"Cyberdyne Systems\",\"client_company\": \"Cyberdyne Systems\",\"client_address\": \"18144 El Camino Real, Sunnyvale, California\",\"client_email\": \"sales@example.com\",\"items\": [ { \"name\": \"T-800 Prototype Research\", \"price\": 1000.00 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 300.00 } ],\"discount\": 100,\"tax\": 87,\"total\": 1287,\"note\": \"Thank you for your support of advanced robotics.\"}"
}'
[POST] /pdf/convert/from/html (csv input)
Automate and scale PDF generation using built-in PDF.co HTML templates. API loads data from templateData
parameter and uses this data to inject data into your html template.
Create, test and manage your HTML templates here
Templates use {{Mustache}}
and Handlebars
templating syntax. You just need to insert macros surrounded by double brackets like {{
and }}
.
Some Examples of macro inside html template:
{{variable1}}
will be replaced withtest
if you settemplateData
to{ "variable1": "test"}
{{object1.variable1}}
will be replaced withtest
if you settemplateData
to{ "object1": { "variable1": "test"} }
- simple conditions are also supported. For example:
{{#if paid}} invoice was paid {{/if}}
will showinvoice was paid
whentemplateData
is set to{ "paid": true }
Attributes |
---|
templateId required Set to the ID of your HTML template. You can find and copy ID at HTML templates section in the app. |
templateData required Set it to a string with input JSON data (recommended) or from CSV data. |
Sample JSON input:
"templateData": "{ 'paid': true, 'invoice_id': '0002', 'total': '$999.99' }"
NOTE: If you use JSON as input then make sure to escape it first (with JSON.stringify(dataObject)
in JS). Escaping is when every "
is replaced with \"
(most programming languages are doing it automatically though.
Example with "
be escaped as \"
then:
"templateData": "{ \"paid\": true, \"invoice_id\": \"0002\", \"total\": \"$999.99\" }"
You can also use simple CSV as input:
"templateData": "paid,invoice_id,total
true,0002,$999.99"
Attributes |
---|
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. |
mediaType optional Uses print by default. Set to screen to convert HTML as it appears in a browser; print to convert as it appears for printing; none sets media type to none . |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configuration for fine-tuning and extra options. Explore PDF.co knowledgebase for profile examples, The input must be in string format. |
header optional Set to HTML for the header to be applied on every page at the header. |
footer optional Set to HTML for the footer to be applied on every page at the bottom. |
The header
and footer
params should 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
For example, the following markup will generate Page N of NN
page numbering:
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>
Sample advanced header and footer:
"header": "<div style='width:100%'><span style='font-size:10px;margin-left:20px;width:50%;float:left'>LEFT SUBHEADER</span><span style='font-size:8px;width:30%;float:right'>RIGHT SUBHEADER</span></div>",
"footer": "<div style='width:100%;text-align:right'><span style='font-size:10px;margin-right:20px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span></div>"
- Method: POST
- URL: /v1/pdf/convert/from/html
Query parameters
No query parameters accepted.
Body payload
{
"templateId": 1,
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"invoice_id\": \"0021\",\"invoice_date\": \"August 29, 2041\",\"invoice_dateDue\": \"September 29, 2041\",\"issuer_name\": \"Sarah Connor\",\"issuer_company\": \"T-800 Research Lab\",\"issuer_address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\"issuer_website\": \"www.example.com\",\"issuer_email\": \"info@example.com\",\"client_name\": \"Cyberdyne Systems\",\"client_company\": \"Cyberdyne Systems\",\"client_address\": \"18144 El Camino Real, Sunnyvale, California\",\"client_email\": \"sales@example.com\",\"items\": [ { \"name\": \"T-800 Prototype Research\", \"price\": 1000.00 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 300.00 } ],\"discount\": 100,\"tax\": 87,\"total\": 1287,\"note\": \"Thank you for your support of advanced robotics.\"}"
}
Example responses
/pdf/convert/from/html (csv data input)
{
"url": "https://pdf-temp-files.s3.amazonaws.com/6fc1712ba6274b06a88329cffd5ab217/newDocument.pdf",
"pageCount": 1,
"error": false,
"status": 200,
"name": "newDocument.pdf",
"remainingCredits": 98962241,
"credits": 9
}
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 '{
"templateId": 1,
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"invoice_id\": \"0021\",\"invoice_date\": \"August 29, 2041\",\"invoice_dateDue\": \"September 29, 2041\",\"issuer_name\": \"Sarah Connor\",\"issuer_company\": \"T-800 Research Lab\",\"issuer_address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\"issuer_website\": \"www.example.com\",\"issuer_email\": \"info@example.com\",\"client_name\": \"Cyberdyne Systems\",\"client_company\": \"Cyberdyne Systems\",\"client_address\": \"18144 El Camino Real, Sunnyvale, California\",\"client_email\": \"sales@example.com\",\"items\": [ { \"name\": \"T-800 Prototype Research\", \"price\": 1000.00 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 300.00 } ],\"discount\": 100,\"tax\": 87,\"total\": 1287,\"note\": \"Thank you for your support of advanced robotics.\"}"
}'
[POST] /pdf/convert/from/html (advanced template with auto calc)
Automate and scale PDF generation using built-in PDF.co HTML templates. API loads data from templateData
parameter and uses this data to inject data into your html template.
Create, test and manage your HTML templates here
Templates use {{Mustache}}
and Handlebars
templating syntax. You just need to insert macros surrounded by double brackets like {{
and }}
.
Some Examples of macro inside html template:
{{variable1}}
will be replaced withtest
if you settemplateData
to{ "variable1": "test"}
{{object1.variable1}}
will be replaced withtest
if you settemplateData
to{ "object1": { "variable1": "test"} }
- simple conditions are also supported. For example:
{{#if paid}} invoice was paid {{/if}}
will showinvoice was paid
whentemplateData
is set to{ "paid": true }
Attributes |
---|
templateId required Set to the ID of your HTML template. You can find and copy the ID at HTML templates section in the app. |
templateData required Set it to a string with input JSON data (recommended) or from CSV data. |
Sample JSON input:
"templateData": "{ 'paid': true, 'invoice_id': '0002', 'total': '$999.99' }"
NOTE: If you use JSON as input then make sure to escape it first (with JSON.stringify(dataObject)
in JS). Escaping is when every "
is replaced with \"
(most programming languages are doing it automatically though.
Example with "
be escaped as \"
then:
"templateData": "{ \"paid\": true, \"invoice_id\": \"0002\", \"total\": \"$999.99\" }"
You can also use simple CSV as input:
"templateData": "paid,invoice_id,total
true,0002,$999.99"
Attributes |
---|
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. |
mediaType optional Uses print by default. Set to screen to convert HTML as it appears in a browser; print to convert as it appears for printing; none sets media type to none . |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configurations for fine-tuning and extra options. Explore PDF.co knowledgebase for profile examples, The input must be in string format. |
header optional Set to HTML for the header to be applied on every page at the header. |
footer optional Set to HTML for the footer to be applied on every page at the bottom. |
The header
and footer
params should 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
For example, the following markup will generate Page N of NN
page numbering:
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>
Sample advanced header and footer:
"header": "<div style='width:100%'><span style='font-size:10px;margin-left:20px;width:50%;float:left'>LEFT SUBHEADER</span><span style='font-size:8px;width:30%;float:right'>RIGHT SUBHEADER</span></div>",
"footer": "<div style='width:100%;text-align:right'><span style='font-size:10px;margin-right:20px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span></div>"
- Method: POST
- URL: /v1/pdf/convert/from/html
Query parameters
No query parameters accepted.
Body payload
{
"templateId": 2,
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"invoice_id\": \"0021\",\"invoice_date\": \"August 29, 2041\",\"invoice_dateDue\": \"September 29, 2041\",\"issuer_name\": \"Sarah Connor\",\"issuer_company\": \"T-800 Research Lab\",\"issuer_address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\"issuer_website\": \"www.example.com\",\"issuer_email\": \"info@example.com\",\"client_name\": \"Cyberdyne Systems\",\"client_company\": \"Cyberdyne Systems\",\"client_address\": \"18144 El Camino Real, Sunnyvale, California\",\"client_email\": \"sales@example.com\",\"items\": [ {\"name\": \"T-800 Prototype Research\",\"price\": 1000.0 }, {\"name\": \"T-800 Cloud Sync Setup\",\"price\": 300.0 }],\"discount\": 0.1,\"tax\": 0.0725,\"note\": \"Thank you for your support of advanced robotics.\"}"
}
Example responses
/pdf/convert/from/html (using template with auto calc)
{
"url": "https://pdf-temp-files.s3.amazonaws.com/31a398c79ab14d27b029f268cf9660c8/newDocument.pdf",
"pageCount": 1,
"error": false,
"status": 200,
"name": "newDocument.pdf",
"remainingCredits": 99003839,
"credits": 9
}
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 '{
"templateId": 2,
"name": "newDocument.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"invoice_id\": \"0021\",\"invoice_date\": \"August 29, 2041\",\"invoice_dateDue\": \"September 29, 2041\",\"issuer_name\": \"Sarah Connor\",\"issuer_company\": \"T-800 Research Lab\",\"issuer_address\": \"435 South La Fayette Park Place, Los Angeles, CA 90057\",\"issuer_website\": \"www.example.com\",\"issuer_email\": \"info@example.com\",\"client_name\": \"Cyberdyne Systems\",\"client_company\": \"Cyberdyne Systems\",\"client_address\": \"18144 El Camino Real, Sunnyvale, California\",\"client_email\": \"sales@example.com\",\"items\": [ {\"name\": \"T-800 Prototype Research\",\"price\": 1000.0 }, {\"name\": \"T-800 Cloud Sync Setup\",\"price\": 300.0 }],\"discount\": 0.1,\"tax\": 0.0725,\"note\": \"Thank you for your support of advanced robotics.\"}"
}'
[POST] /pdf/convert/from/html (multi page invoice with qr code and auto calc)
Automate and scale PDF generation using built-in PDF.co HTML templates. API loads data from templateData
parameter and uses this data to inject data into your html template.
Create, test and manage your HTML templates here
Templates use {{Mustache}}
and Handlebars
templating syntax. You just need to insert macros surrounded by double brackets like {{
and }}
.
Some Examples of macro inside html template:
{{variable1}}
will be replaced withtest
if you settemplateData
to{ "variable1": "test"}
{{object1.variable1}}
will be replaced withtest
if you settemplateData
to{ "object1": { "variable1": "test"} }
- simple conditions are also supported. For example:
{{#if paid}} invoice was paid {{/if}}
will showinvoice was paid
whentemplateData
is set to{ "paid": true }
Attributes |
---|
templateId required Set to the ID of your HTML template. You can find and copy the ID at HTML templates section in the app. |
templateData required Set it to a string with input JSON data (recommended) or from CSV data. |
Sample JSON input:
"templateData": "{ 'paid': true, 'invoice_id': '0002', 'total': '$999.99' }"
NOTE: If you use JSON as input then make sure to escape it first (with JSON.stringify(dataObject)
in JS). Escaping is when every "
is replaced with \"
(most programming languages are doing it automatically though.
Example with "
be escaped as \"
then:
"templateData": "{ \"paid\": true, \"invoice_id\": \"0002\", \"total\": \"$999.99\" }"
You can also use simple CSV as input:
"templateData": "paid,invoice_id,total
true,0002,$999.99"
Attributes |
---|
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. |
mediaType optional Uses print by default. Set to screen to convert HTML as it appears in a browser; print to convert as it appears for printing; none sets media type to none . |
async optional Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish. |
profiles optional Use this parameter to set additional configuration for fine-tuning and extra options, The input must be in string format. Explore PDF.co knowledgebase for profile examples. |
header optional Set to HTML for the header to be applied on every page at the header. |
footer optional Set to HTML for the footer to be applied on every page at the bottom. |
The header
and footer
params should 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
For example, the following markup will generate Page N of NN
page numbering:
<span style='font-size:10px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span>
Sample advanced header and footer:
"header": "<div style='width:100%'><span style='font-size:10px;margin-left:20px;width:50%;float:left'>LEFT SUBHEADER</span><span style='font-size:8px;width:30%;float:right'>RIGHT SUBHEADER</span></div>",
"footer": "<div style='width:100%;text-align:right'><span style='font-size:10px;margin-right:20px'>Page <span class='pageNumber'></span> of <span class='totalPages'></span>.</span></div>"
- Method: POST
- URL: /v1/pdf/convert/from/html
Query parameters
No query parameters accepted.
Body payload
{
"templateId": 3,
"name": "multipagedInvoiceWithQRCode.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"company_name\": \"Lovely Company Inc.\",\"company_address\": \"1234 Market St\\nSan Francisco, California 94102\\nUSA\",\"company_logo\": \"https:\/\/pdfco-test-files.s3.us-west-2.amazonaws.com\/pdf-edit\/logo.png\",\"barcode_value\": \"sample encoded barcode value for page 1\\nwuth line breaks if needed\\n\\nOrder id:\",\"ocr_scanline\": \"OCR-A 123567890\",\"order_id\": \"1122455\",\"order_date\": \"15 Jan 2022\",\"customer_id\": \"T8001\",\"shipped_date\": \"20 Jan 2022\",\"shipped_via\": \"UPS\",\"bill_to_name\": \"T-800 Research Lab\",\"bill_to_address\": \"435 South La Fayette Park Place, \\nLos Angeles, CA 90057\\nUSA\",\"ship_to_name\": \"Cyberdyne Systems\",\"ship_to_address\": \"18144 El Camino Real\\nSunnyvale, California\\nUSA\",\"freight\": 19.95,\"notes\": \"Thank you for your purchase.\\nThanks for your support of advanced robotics.\",\"items\": [ { \"name\": \"T-800 Prototype Research\", \"price\": 50.0, \"quantity\": 2 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 150.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 24.99, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 199.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 19.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 49.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 1000.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 12.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 25.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 24.99, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 14.95, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 149.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 99.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 100.0, \"quantity\": 4 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 9 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 2 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 3.49, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 15.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research\", \"price\": 50.0, \"quantity\": 2 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 150.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 24.99, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 199.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 19.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 49.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 1000.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 12.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 25.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 24.99, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 14.95, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 149.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 99.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 100.0, \"quantity\": 4 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 9 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 2 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 3.49, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Prototype Research\", \"price\": 50.0, \"quantity\": 2 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 150.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 24.99, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 199.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 19.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 49.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 1000.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 12.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 25.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 24.99, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 14.95, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 149.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 99.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 100.0, \"quantity\": 4 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 9 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 2 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 3.49, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }]\r\n}"
}
Example responses
/pdf/convert/from/html (multi page invoice with qr code and auto calc)
{
"url": "https://pdf-temp-files.s3.amazonaws.com/839a4e2f10e249739ed0c167b453e36b/multipagedInvoiceWithQRCode.pdf",
"pageCount": 6,
"error": false,
"status": 200,
"name": "multipagedInvoiceWithQRCode.pdf",
"duration": 3540,
"remainingCredits": 98536992,
"credits": 54
}
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 '{
"templateId": 3,
"name": "multipagedInvoiceWithQRCode.pdf",
"mediaType": "print",
"margins": "40px 20px 20px 20px",
"paperSize": "Letter",
"orientation": "Portrait",
"printBackground": true,
"header": "",
"footer": "",
"async": false,
"templateData": "{\"paid\": true,\"company_name\": \"Lovely Company Inc.\",\"company_address\": \"1234 Market St\\nSan Francisco, California 94102\\nUSA\",\"company_logo\": \"https:\/\/pdfco-test-files.s3.us-west-2.amazonaws.com\/pdf-edit\/logo.png\",\"barcode_value\": \"sample encoded barcode value for page 1\\nwuth line breaks if needed\\n\\nOrder id:\",\"ocr_scanline\": \"OCR-A 123567890\",\"order_id\": \"1122455\",\"order_date\": \"15 Jan 2022\",\"customer_id\": \"T8001\",\"shipped_date\": \"20 Jan 2022\",\"shipped_via\": \"UPS\",\"bill_to_name\": \"T-800 Research Lab\",\"bill_to_address\": \"435 South La Fayette Park Place, \\nLos Angeles, CA 90057\\nUSA\",\"ship_to_name\": \"Cyberdyne Systems\",\"ship_to_address\": \"18144 El Camino Real\\nSunnyvale, California\\nUSA\",\"freight\": 19.95,\"notes\": \"Thank you for your purchase.\\nThanks for your support of advanced robotics.\",\"items\": [ { \"name\": \"T-800 Prototype Research\", \"price\": 50.0, \"quantity\": 2 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 150.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 24.99, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 199.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 19.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 49.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 1000.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 12.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 25.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 24.99, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 14.95, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 149.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 99.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 100.0, \"quantity\": 4 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 9 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 2 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 3.49, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 15.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research\", \"price\": 50.0, \"quantity\": 2 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 150.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 24.99, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 199.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 19.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 49.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 1000.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 12.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 25.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 24.99, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 14.95, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 149.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 99.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 100.0, \"quantity\": 4 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 9 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 2 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 3.49, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Prototype Research\", \"price\": 50.0, \"quantity\": 2 }, { \"name\": \"T-800 Cloud Sync Setup\", \"price\": 150.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 24.99, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 199.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 19.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 20.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 49.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 1000.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 12.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 25.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 24.99, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 14.95, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 149.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 99.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 100.0, \"quantity\": 4 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 9 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 2 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 3 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 3.49, \"quantity\": 3 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }, { \"name\": \"T-800 Cloud Sync Setup 3\", \"price\": 30.0, \"quantity\": 5 }, { \"name\": \"T-800 Prototype Research 2\", \"price\": 10.0, \"quantity\": 1 }]\r\n}"
}'
[GET] /templates/html
Return all HTML templates for the current user. Please use GET
request.
Manage HTML templates at https://app.pdf.co/templates/html
- Method: GET
- URL: /v1/templates/html
Query parameters
No query parameters accepted.
Body payload
No body parameters accepted.
Example responses
/templates/html
{
"templates": [
{
"id": 1,
"type": "system",
"title": "General Invoice Template",
"description": "sample invoice template showcasing use of Mustache templates syntax for generating invoices"
},
{
"id": 15,
"type": "user",
"title": "User Template 1",
"description": ""
}
],
"remainingCredits": 99204004,
"credits": 2
}
Code Snippet
CURL
curl --location --request GET 'https://api.pdf.co/v1/templates/html' \
--header 'Content-Type: application/json' \
--header 'x-api-key: '
[GET] /templates/html/:id
Returns HTML template by template’s id. Please use GET
request.
Manage HTML templates at https://app.pdf.co/templates/html
- Method: GET
- URL: /v1/templates/html/:id
Query parameters
No query parameters accepted.
Body payload
No body parameters accepted.
Example responses
/templates/html/:id
{
"id": 1,
"type": "system",
"title": "General Invoice Template",
"description": "sample invoice template showcasing use of Mustache templates syntax for generating invoices",
"body": "<!doctype html>\r\n<html lang=\"en-US\">\r\n<head>\r\n<title>Invoice </title> \r\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css\" integrity=\"sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn\" crossorigin=\"anonymous\">\r\n</head> \r\n<body>\r\n \r\n <div style=\"border-width: 3px;border-style: solid; border-color: #008000;border-radius: 8px; color: #008000; opacity:0.4; position: absolute; z-index: 1; left:80%; top:3%; font-size: 60pt;transform: rotate(-20deg)\">\r\n PAID </div>\r\n \r\n \r\n <div class=\"container\">\r\n <div class=\"\">\r\n <div class=\"\">\r\n \r\n <!-- invoice: header begin-->\r\n <div class=\"row col-md-12\">\r\n <div class=\"col col-md-6\">\r\n <div class=\"font-weight-bold\"></div>\r\n\r\n <div class=\"\"></div>\r\n <div class=\"\"></div>\r\n <div class=\"\"></div>\r\n <div class=\"\"></div>\r\n </div>\r\n <div class=\"col col-md-6\">\r\n <div class=\"\">\r\n <div class=\"\">\r\n <span class=\"font-weight-bold\">Invoice Number:</span> \r\n </div>\r\n <div class=\"\">\r\n <span class=\"font-weight-bold\">Invoice Date:</span> \r\n </div>\r\n <div class=\"\">\r\n <span class=\"font-weight-bold\">Invoice Due Date:</span> \r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n \r\n<div class=\"row col-md-12\">\r\n <div class=\"col col-md-6\"></div>\r\n\r\n <div class=\"col col-md-6\">\r\n <div class=\"font-weight-bold footer-title\">BILL TO</div>\r\n <div class=\"\">\r\n <div class=\"\"><strong>Name:</strong> </div>\r\n <div class=\"\"><strong>Company:</strong> </div>\r\n <div class=\"\"><strong>Address:</strong> </div>\r\n <div class=\"\"><strong>Email:</strong> </div>\r\n </div>\r\n </div> \r\n </div>\r\n \r\n <div class=\"row col-md-12\">\r\n <div class=\"col col-md-12\">\r\n <table class=\"table table-striped\" cellspacing=\"0\">\r\n <thead>\r\n <tr class=\"table-head\">\r\n <th class=\"text-left\">Item</th>\r\n <th class=\"text-right\">Price</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n \r\n <tr>\r\n <td class=\"text-left\"></td>\r\n <td class=\"text-right\"></td>\r\n </tr>\r\n \r\n </tbody>\r\n </table> \r\n </div> \r\n\r\n </div>\r\n <div class=\"row col-md-12\">\r\n <div class=\"col col-md-6\">\r\n </div>\r\n <div class=\"col col-md-6 text-right\">\r\n <div style=\"margin-bottom: 10px;\">Discount: <span class=\"amount\"></span></div>\r\n <div style=\"margin-bottom: 10px;\">Tax: <span class=\"amount\"></span></div>\r\n <div class=\"font-weight-bold footer-title\">TOTAL: <span class=\"total-amount amount font-weight-bold\"></span></div> \r\n </div>\r\n \r\n </div>\r\n </div> \r\n </div>\r\n </div>\r\n <div class=\"container text-muted\"></div>\r\n </div>\r\n</body>\r\n</html>\r\n",
"remainingCredits": 99204002,
"credits": 2
}
Code Snippet
CURL
curl --location --request GET 'https://api.pdf.co/v1/templates/html/1' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw ''
Samples
- C# - CCDA record to PDF
- C# - Generate PDF Invoice From HTML Template
- C# - Generate PDF Quotation
- C# - Invoice With Multiple Pages
- C# - Template Iterating Array
- Google Apps Script - Google Spreadsheet to PDF Invoice
- Java - Generate PDF Invoice From HTML Template
- Java - Invoice With Multiple Pages
- JavaScript - Generate PDF Invoice From HTML Template (Node.js)
- JavaScript - Generate PDF Invoice From HTML Template (Node.js) - Async API
- JavaScript - Invoice With Multiple Pages (Node.js)
- JavaScript - Invoice With Multiple Pages (Node.js) - Async API
- JavaScript - Temple Iterating Array
- Javascript-Snippets - breaklines
- Javascript-Snippets - getFinalAmount
- Javascript-Snippets - getTotal
- Javascript-Snippets - getTotalLines
- Javascript-Snippets - numberFormat
- PHP - Generate PDF Invoice From HTML Template
- PHP - Invoice With Multiple Pages
- PowerShell - Generate PDF Invoice From HTML Template
- PowerShell - Invoice With Multiple Pages
- Python - Generate PDF Invoice From HTML Template
- Python - Invoice With Multiple Pages
- Salesforce - PDF From Html Template
- TEMPLATES-SAMPLES - Advanced Invoice With Multiple Pages
- TEMPLATES-SAMPLES - Array Iteration
- TEMPLATES-SAMPLES - CCDA record Template
- TEMPLATES-SAMPLES - Invoice With Auto Calculations and QR Code
- TEMPLATES-SAMPLES - Invoice With Barccode
- TEMPLATES-SAMPLES - Multipage invoice with line items
- TEMPLATES-SAMPLES - Quote Template
- TEMPLATES-SAMPLES - Simple Invoice using Mustache Template and QR Code Barcode
- TEMPLATES-SAMPLES - Simple Template
- TEMPLATES-SAMPLES - Simple Template With CSV Input
- VB.NET - Generate PDF Invoice From HTML Template
- VB.NET - Invoice With Multiple Pages
- cURL - Generate PDF Invoice From HTML Template
Copyright © 2016 - 2023 PDF.co