convert contents of a div to pdf - javascript

I want to convert the contents in a <div> to a pdf.
The <div> contains information in various languages as well as images.
I want to use jQuery or C# asp.net.
How can I achieve this?

MrRio/jsPDF Client-side JavaScript PDF generation for everyone.
Simply include the jsPDF library in your , generate your PDF using the many built-in functions, then hook up a button to trigger the download. All the examples here use jQuery.

Related

How to generate pdf from html and css in Vuejs?

I'm working on a tool "Resume Builder" using Vuejs. Is there any bettter way to generate pdf ( of resume ) from html with css . I have used jsPdf Library but not getting desired outcomes. I want to keep html "a" tag clickable in generated pdf. I have also tried html2canvas.js but in that "a" tag is not clickable due to image in pdf. jsPdf is generating pdf but not applying css.
I recommend you to investigate a bit different approach for generating PDF from HTML just because all the client-side libraries for HTML to PDF generation have lots of problems when generating really complex documents with lots of formatting etc.
The alternative way is to perform the PDF generation itself on the server-side. For example, you could make use of Headless Chrome managed by your backend for turning any HTML into PDF.
We used a very similar approach to implement pdf generation for this free resume builder service. The only downside we faced was that different browsers like Firefox or IE might occasionally display an HTML document a bit different than it's printed out as PDF bu Chrome. Good luck!
You might want to give Pdf Make a try.
PDF Make on Github
It has support for styling and links. But you have to do most of the styling yourself.
I found Kendo UI is the best api for pdf from DOM.
https://docs.telerik.com/kendo-ui/framework/drawing/drawing-dom

How to create an interactive pdf file with javascript?

I want to create dynamic pdf files and embed initials and signature to them inside browser. I found pdfkit.org but I need a more comprehensive solution that allows creating functionalities similar to what you see in docusign. Are there solution out there that you can point me to?
From farther research, I learned that PDF & Javascript are good friends. The easiest way to achieve manipulating content within a pdf is to convert it to html, add the changes to it and then convert it back to pdf. There are a few different services available that help you with this kind of conversion. Here are a few of those services:
https://cloudconvert.com
http://www.pdfonline.com/
https://market.mashape.com/netservice/convert-pdf-to-html

Download html with dynamic-css as pdf using python or js

I have a html-content with dynamic-css in python class which will be later passed to a js file. I need to download this html-content as pdf format.
I have gone through various html to pdf convertor tools(pdfkit,pdfcrowd,wkhtmltopdf) but none of them is able to render the dynamic css content.
I have even tried using windows.document.documentElement for obtaining html content with dynamic css rendered.
But this did not work.
My question is: can we generate dynamic css seperately on python or download the complete pdf using js?
Thanks in advance
I have used JSPDF to download pdf from html. It is easy to use. It should help you in your case:
JS Fiddle Html to pdf: http://jsfiddle.net/xzz7n/1/
JSPDF Site https://parall.ax/products/jspdf

how to generate a pdf file of an html page through java script programming

In my html5 hybrid iPad application i am generating a report in one of the pages . What i want is to generate a PDF file of that report and save it in ipad.Please help me with this. I am using JavaScript and mobile jQuery for this.
It is highly inefficient to do this client-side(via Javascript). You should consider doing it server-side(using PHP, ASP/.NET or such). PHP uses a service called iTextSharp for this, PHP uses DOMPDF.
If you want to it with Javascript, http://html2canvas.hertzen.com/ is the best tool you will find! It uses the DOM style to generate an image. The only thing you need to do is then wrap it in a PDF. Have a look at their examples! For example:
http://html2canvas.hertzen.com/examples/artificial/index.html
You can use an open-source library for generating PDF documents, I have already use this library and works fine:
http://code.google.com/p/jspdf/
Try it, I hope that is what you want

how to create a PDF file uing javascript in IE

I want to create a PDF file based on users' query result (in html table).
What is the best javascript/lib I can use for IE?
I found jsPDF but it does not support IE.
Javascript has no support for PDF.Instead if u want to convert the HTML page you are into you can try PDF4ML
I didn't think it was possible to create a PDF entirely in client-side JavaScript. I would imagine any "JavaScript" examples out there use both JS and a server-side language. In the past, I've used the active PDF API with C#.

Categories