Url to call
https://api.html2pdf.solutions/html2pdf/?parameter1=x¶meter2=y etc.
Example:
This generates a PDF of the Google homepage, which can be opened with the password 1234. The file name will be "Hello World". The last two parameters are optional and serve here as an example.
Do not forget, the URL encoding if you use url_to_render with querystring! If you forget to encode the URL, not all parameters will have an effect.
Required Parameter
Parameter | Typ | Example | Description |
---|---|---|---|
UrlToRender | String | http://www.google.com | a valid absolute URL to a html page/template |
Html | String | hello%20world | Alternatively: HTML Source if you generate your HTML dynamically and do not want to make the template available by URL. You may want to use a POST request instead of a GET request in this case if the string is long. POST requests do only make sense in conjunction with the Html parameter. |
Optional Parameters
Parameter | Typ | Example | Description |
---|---|---|---|
HttpUsername | String | user | If your page is user/password protected by HTTP Authentication/Basic Authentication. Value must be alpha numeric. |
HttpPassword | String | test | If your page is user/password protected by HTTP Authentication/Basic Authentication. Please note that not all non alpha numeric characters are allowed here. Please contact support if you need help. |
UserPassword | String | test | If you want to password protect your PDF. |
UsePrintMediaType | Integer | 0, 1 | default: 0 If you want to use print media type please set to 1 |
PrintBackground | Integer | 0, 1 | default: 1 If you do NOT want to print backgrounds please set this to 0 |
HeaderText | String | <span class="title"></span> | Text to display above the rendered screen See also FooterText parameter for more variables/classes |
FooterText | String | <span class="title"></span> - <span class="url"></span> - <span class="date"></span> - Page <span class="pageNumber"></span>/<span class="totalPages"></span> | Does only work with paid version. Will result in: Title of your html template - URL - Date - Page x/y Do not forget to URL encode your text or html. Will then look like this: FooterText=<span%20class%3D"title"><%2Fspan>%20-%20<span%20class%3D"url"><%2Fspan>%20-%20<span%20class%3D"date"><%2Fspan>%20-%20Page%20<span%20class%3D"pageNumber"><%2Fspan>%2F<span%20class%3D"totalPages"><%2Fspan>%0A%0A |
FooterTemplateUrl | http%3A%2F%2Fwww.xy.com (encoded URL) | The FooterTemplateUrl should simply be a page the contains the desired elements you want to show in the footer. If you want to change the size, position of anything etc. simply change your footer template. The URL must contain a HTML Template that can for instance contain an image and some text embedded in HTML/CSS. The target of the URL has to be a html page not a image. This allows you to position your elements as you like und the provided header area. | |
FooterInsetHorizontal | Integer | 0, 14, 100 | 14 is default. 0: Footer will be aligned max left. |
HeaderTemplateUrl | URL | http%3A%2F%2Fwww.xy.com (encoded URL) | The HeaderTemplateUrl should simply be a page the contains the desired elements you want to show in the header. If you want to change the size, position of anything etc. simply change your header template. The URL must contain a HTML Template that can for instance contain an image and some text embedded in HTML/CSS. The target of the URL has to be a html page not a image. This allows you to position your elements as you like und the provided footer area. |
InsetHorizontal | Integer | 20 | Left and right margins |
InsetVertical | Integer | 40 | Top and bottom margins |
ContentDisposition | String | valid values: "attachment", "inline" | attachment is default. Downloads the PDF/JPG. |
Size | String | A0, A1, A2, A3, A4, A5, A6, Ledger, Tabloid, Legal, Letter | A4 is default |
Orientation | String | portrait, landscape | |
FileName | String | somefilename | Changes the default value for the PDF file name |
Title | String | "Your Title" (do not forget to url encode the value) | Changes the default value for the PDF Title that can be found in the PDF Properties. |
Author | String | "John Smith" (do not forget to url encode the value) | Changes the default value for the PDF Author that can be found in the PDF Properties. |
Subject | String | "Your Subject" (do not forget to url encode the value) | Changes the default value for the PDF Subject that can be found in the PDF Properties. |
Zoom | Float | 0.75 (default), 0.5, 1, 1.5 | Zoom in and out |
MaxNrOfPages | Integer | 1 | Limits the number of pages in the pdf. |
Format | String | jpg | pdf (default) or jpg |