Ask Question Share Tweet. Download Source Code View Demo. Kevin Clark Said Can you please help? January 25, at PM. Chetan Allapur Said Surendra Narayan Roy Said August 12, at PM. Ravi Kumar Said Great work bro, thanx A lot June 1, at PM. Abhijit Said May 8, at AM. Shaalan Said March 18, at PM. Leave a reply. How you do this depends on what language you are using.
You can pass the content of the div to the function that handles the conversion, which would return a pdf to the user. The usage of it is as following:. That's all.
Now, when the page javasvript loaded an image screenshot will now be created in the same location as the script tag, which will contain all of the contents of the features div and nothing else. The are other configuration and customization you can do to the div-screenshot mechanism, please check them out here.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Asked 8 years, 4 months ago. Active 8 months ago.
Viewed k times. Improve this question. Midhun Mathew Midhun Mathew 1, 8 8 gold badges 25 25 silver badges 43 43 bronze badges. How can I use jsPDF for downloading a content in specific div? Add a comment.
Active Oldest Votes. Improve this answer.
Mamun I javasrcipt a problem here. The css I have added in here is not getting applied in the pdf file. Also I have some graphs too. What should I do to get those? Using the above code we can able to create a pdf only one time.
But for the second time it is not working. To make it work, check this answer by kristof-feys, We need to declare the doc variable inside the click function. I faced with encoding problem — ema. Show 15 more comments.
May be dlwnload will help someone. Vishnu S Vishnu S 11 11 silver badges 18 18 bronze badges. This worked great for me, thanks. It preserves all the styling but it does have some limitations creates the PDF as an image so it's not searchable; seems to also be slightly blurry.
Worked very fine to me. The only problem was that some of my SVG icons were not rendered!