0

I need some pointer or client side (Jquery code) to convert current web page to PDF....PDF page contain content and few images.

Requirement is to include all content from webpage in PDF but optionally if possible to include image as well then nothing like that.

user2745580
  • 123
  • 7
  • Duplicate: http://stackoverflow.com/questions/25046187/how-to-generate-a-pdf-from-html-web-page and http://stackoverflow.com/questions/17293135/download-a-div-in-a-html-page-as-pdf-using-javascript – Vishal Kamal Dec 11 '15 at 13:33
  • you can see here: [Download a div in a HTML page as pdf using javascript](http://stackoverflow.com/questions/17293135/download-a-div-in-a-html-page-as-pdf-using-javascript) – FlipFloop Dec 11 '15 at 13:42
  • Did you end up finding a solution to this problem? If so enter your own answer or select one of the answers provided as the correct response. – Leonardo Wildt Dec 16 '15 at 16:19

2 Answers2

1

You can use this github repo https://github.com/MrRio/jsPDF But it has no support for CSS as I know

Kamuran Sönecek
  • 3,293
  • 2
  • 30
  • 57
0

Try the JsPDF library that will do this for you very easily. Fiddle

If you click on the top right corner you can see the code for the result.

$(document).ready(function(){ 
var doc = new jsPDF();


var specialElementHandlers = {
'#editor': function(element, renderer){
    return true;
}
};

$('#cmd').click(function () {
    doc.fromHTML($('#content').get(0), 15, 15, {
'width': 170, 
'elementHandlers': specialElementHandlers
});
    doc.save('sample-file.pdf');
   });
});
Leonardo Wildt
  • 2,529
  • 5
  • 27
  • 56