This page contains various examples of using the HTML to PDF API with HTTP POST. The examples are complete and fully functional. Read more about how to convert HTML to PDF with HTTP POST.
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "example.pdf" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "MyLayout.pdf" \ -F "file=@/path/to/MyLayout.html" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "HelloWorld.pdf" \ --form-string "text=<html><body><h1>Hello World!</h1></body></html>" \ https://api.pdfcrowd.com/convert/20.10/ # or use custom HTML producer html_producer | curl -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "HelloWorld.pdf" \ -F "text=<-" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "letter_landscape.pdf" \ -F "page_size=Letter" \ -F "orientation=landscape" \ -F "no_margins=true" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "header_footer.pdf" \ -F "header_height=15mm" \ -F "footer_height=10mm" \ --form-string "header_html=<a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a>" \ --form-string "footer_html=<center><span class='pdfcrowd-page-number'></span></center>" \ -F "margin_top=0" \ -F "margin_bottom=0" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "form.pdf" \ -F "enable_pdf_forms=true" \ --form-string "text=<html><body>Enter name:<input type=text></body></html>" \ https://api.pdfcrowd.com/convert/20.10/ # or use custom HTML producer html_producer | curl -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "form.pdf" \ -F "enable_pdf_forms=true" \ -F "text=<-" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "zoom_300.pdf" \ -F "scale_factor=300" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "slide_show.pdf" \ -F "page_layout=single-page" \ -F "page_mode=full-screen" \ -F "initial_zoom_type=fit-page" \ -F "orientation=landscape" \ -F "no_margins=true" \ -F "url=https://pdfcrowd.com/api/" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "html_part.pdf" \ -F "element_to_convert=#main" \ -F "url=https://pdfcrowd.com/api/" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "html_inject.pdf" \ --form-string "custom_javascript=el=document.createElement('h2'); el.textContent='Hello from Pdfcrowd API'; el.style.color='red'; el_before=document.getElementsByTagName('h1')[0]; el_before.parentNode.insertBefore(el, el_before.nextSibling)" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "bootstrap.pdf" \ -F "viewport_width=992" \ -F "rendering_mode=viewport" \ -F "smart_scaling_mode=viewport-fit" \ -F "no_margins=true" \ -F "url=https://getbootstrap.com/" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "highlight_background.pdf" \ --form-string "custom_javascript=libPdfcrowd.highlightHtmlElements({backgroundColor: 'rgba(255, 191, 0, 0.1)', borderColor:null})" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "highlight_borders.pdf" \ --form-string "custom_javascript=libPdfcrowd.highlightHtmlElements({borderColor: 'orange', backgroundColor: null, padding: '4px', margin: '4px'})" \ -F "url=http://www.example.com" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ --form-string "data_string={ \"name\": \"World\", \"product\": \"Pdfcrowd API\" }" \ --form-string "text=Hello {{ name }} from {{ product }}" \ https://api.pdfcrowd.com/convert/20.10/ # or use custom HTML producer html_producer | curl -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ --form-string "data_string={ \"name\": \"World\", \"product\": \"Pdfcrowd API\" }" \ -F "text=<-" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ --form-string "data_string=<?xml version=\"1.0\" encoding=\"UTF-8\"?> <data> <name>World</name> <product>Pdfcrowd API</product> </data>" \ --form-string "text=Hello {{ data.name }} from {{ data.product }}" \ https://api.pdfcrowd.com/convert/20.10/ # or use custom HTML producer html_producer | curl -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ --form-string "data_string=<?xml version=\"1.0\" encoding=\"UTF-8\"?> <data> <name>World</name> <product>Pdfcrowd API</product> </data>" \ -F "text=<-" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ -F "data_string=name: World product: Pdfcrowd API" \ --form-string "text=Hello {{ name }} from {{ product }}" \ https://api.pdfcrowd.com/convert/20.10/ # or use custom HTML producer html_producer | curl -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ -F "data_string=name: World product: Pdfcrowd API" \ -F "text=<-" \ https://api.pdfcrowd.com/convert/20.10/
curl -f -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ -F "data_string=name,product World,Pdfcrowd API" \ --form-string "text=Hello {{ name }} from {{ product }}" \ https://api.pdfcrowd.com/convert/20.10/ # or use custom HTML producer html_producer | curl -u "demo:ce544b6ea52a5621fb9d55f8b542d14d" \ -o "output.pdf" \ -F "data_string=name,product World,Pdfcrowd API" \ -F "text=<-" \ https://api.pdfcrowd.com/convert/20.10/