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 correctly formatted. 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.
Step 2: Render some test pages to PDF
Step 3: Write the code
There are several possibilities to set up your website 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://api.html2pdf.solutions/html2pdf/
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: