How to generate pdf of some part of the webpage
This is an advanced article on Print Friendly API.
Before continue with this article you must read our previous article i.e http://www.waytocode.com/2013/how-togenerate-pdf-using-php-net-java-html/
Once you have completed with previous article, you will be able to generate PDF of entire web page.
But this article focuses on How to generate pdf of some part or some section of a webpage or
Print Friendly is the most easiest Free API , which will allow you to generate PDF of entire page or part of page.
During generation of PDF there are 2 parts of pdf.
- PDF title
- PDF Content portion
Steps for how to print part of a page
Set title of the PDF or Print page
In your View / Html page just create a DIV tag and give a class name as “pf-title”
<div class="pf-title"> This is the title pf the page</div>
Generate PDF / Print part of a webpage
In you View / Html page just create a DIV tag,just give the class name as print-only and inside that DIV tag put all your contents that you want to see while printing the page or Generating the PDF.
<div class="print-only"> This is the contents of the generated PDF or Page</div>