Tutorial: How to implement a "render this page to PDF button"
Step 1: Prepare the HTML pages
In order to create useful PDFs from HTML you first need to prepare the HTML Templates in a way that they can be printed without errors and malformating. Many state-of-the-art websites got a print button anyway or may be printed as they are without limitations. If your site is missing this feature you may create an additional dynamic template that ignores menus, banner, teasers etc. or even better use a CSS print template.
Note that there is a parameter called landscape if your HTML pages are too wide for the default portrait format.
Before you start writing code be sure to test your printable pages by using our Online Demo
Step 2: Render some test pages to PDF
You may also test the html2pdf parameters like landscape, JPG quality, Hyperlinks etc. If you do not want to use the default values be sure to include them in your code.
Step 3: Write the code
There are several possibilities to set up your site for html2pdf.
A) If you simply want to render a standard page (not a special print page) you just need to put the following link to your "render this page to PDF button": http://convert.html2pdf.seven49.net/ The Script will request the referer and render it to PDF.
B) If you want to insert the link in your current code the dynamic link on the "render this page to PDF button" should look something like this: