To convert an url or web page to PDF using our API Rest is necessary to perform a POST call to the following URL (ENDPOINT):
https://getoutpdf.com/api/convert/url-to-pdf
Our Rest API does not have operations via GET parameters
api_key
Api key generated for your license. You can see your api key url
URL to convert to PDFpage_predefined
Predefined page sizepage_width
Page width in millimeters (mm)page_height
Page height in millimeters (mm)page_orientation
Page orientationpage_number
Add page numbersgrayscale
Grayscale PDFmargin_left
Left margin in millimeters (mm)margin_top
Top margin in millimeters (mm)margin_right
Right margin in millimeters (mm)margin_bottom
Bottom margin in millimeters (mm)html_disable_javascript
Do not run JavaScripthtml_hide_images
Do not print imageshtml_hide_backgrounds
Do not print backgroundshtml_disable_hyperlinks
Do not make hyperlinkshtml_zoom
Page zoomapplication/x-www-form-urlencoded
, with the parameters described above.
Or you can send parameters via the JSON format, using the HTML Header application/json
:
{ "api_key" : "...", //string, required "url" : "...", //string, required "page_predefined" : "...", //string, optional, default: A4, values:A1|A2|A3|A4|Dle|Executive|Folio|Ledger|Legal|Letter "page_width" : "...", //string, optional, min: 1 "page_height" : "...", //string, optional, min: 1 "page_orientation" : "...", //string, optional, default: portrait, values:portrait|landscape "page_number" : "...", //string, optional, default: false "grayscale" : "...", //string, optional, default: false "margin_left" : "...", //string, optional, default: 0, min: 0 "margin_top" : "...", //string, optional, default: 0, min: 0 "margin_right" : "...", //string, optional, default: 0, min: 0 "margin_bottom" : "...", //string, optional, default: 0, min: 0 "html_disable_javascript" : "...", //string, optional, default: false "html_hide_images" : "...", //string, optional, default: false "html_hide_backgrounds" : "...", //string, optional, default: false "html_disable_hyperlinks" : "...", //string, optional, default: false "html_zoom" : "..." //string, optional, default: 100, min: 0 }
{ "api_key" : "64b5d1054b69e676b9984d8406c5209a6ba78", "url" : "http://www.getoutpdf.com", "page_predefined" : "A4", "page_width" : 200.55, "page_height" : 300.75, "page_orientation" : "portrait", "page_number" : false, "grayscale" : false, "margin_left" : 2.45, "margin_top" : 2.45, "margin_right" : 2.45, "margin_bottom" : 2.45, "html_disable_javascript" : true, "html_hide_images" : false, "html_hide_backgrounds" : true, "html_disable_hyperlinks" : false, "html_zoom" : 50 }
If the operation is successful the response is a JSON with the following structure:
{ "api_key": "...", // string - Api key used for your license "pdf_base64": "...", // string - PDF file encoded in base64 "tokens_used": "...", // integer - Tokens used in operation "tokens_left": "..." // integer - Tokens left }
If an error in sending parameters occurs, the response is a JSON with the following structure:
{ "errors": { "param1": [ // string - Parameter name that generated the error "message" // string - Error description ], "param2": [ "message" ], ... "paramN": [ "message" ] } }
If a operation error occurs, the answer will be a JSON with the following structure:
{ "errors": [ "message1", "message2", ... "messageN" ] }