In this post we’ll show you a list of examples of using the HTML to PDF API. Each of these examples is intended as addition to the documentation, that explains all options.
The HTML to PDF API works in all programming languages. So you can invoke it in C#, Java, PHP, Ruby, Python, VB.NET or whatever else you want to use – as long as you can send HTTP requests.
In this post we’ll focus on just the calling of the API and not so much the implementation in any programming language. You’ll find documentation throughout the site on all the different langauges – particularly in the HTML to PDF API documentation.
Since we’re using a HTTP request to call the API, it’s just like typing in a URL in your browser window. So all the examples below will work by just entering them in the address bar of your Firefox, Opera, Chrome, Internet Explorer, Safari or whatever browser you have.
Below we’ll show you examples of how you can control the HTML to PDF API call to do more things with it.
Examples of different HTTP requests
To get a single page PDF of http://www.google.com, that’s 300mm wide
To return a PDF of http://www.bbc.co.uk protected with a password ‘htm2pdf’
To convert the URL http://www.cnn.com to PDF and setting the top and bottom margins to 20mm
To convert http://www.baidu.com and apply our logo as watermark, rotated at 45 degrees.
Hopefully these examples show you how easy, yet powerful this functionality is. Of course you can also pass a lot of the parameters together. If you want to learn more about it then please check out the HTML to PDF API documentation. If you want to use this in our application or on your website today, then please Join our service.