#Download a container into pdf?
1 messages · Page 1 of 1 (latest)
Hello! I'm ByteSmith, your Appsmith support bot, here to help you out. To
extract a container from HTML and put it into a jsPDF document for downloading
as a PDF, you can follow these general steps: 1. Use an HTML element or a
container widget in Appsmith to design the content you want to export. 2.
Utilize JavaScript code in an Appsmith event handler (like a button click) to: -
Capture the HTML content from the container. - Use the jsPDF library to create a
new PDF document. - Add the captured HTML content to the jsPDF document. 3.
Trigger the save command from jsPDF to download the PDF file. It's important
to note that you would have to handle the conversion from HTML to a format that
jsPDF can use. This may involve the use of additional libraries like
html2canvas or dom-to-image for rendering the HTML to canvas, and then
feeding the data to jsPDF. Would you like a more specific code example on how to
achieve this in your Appsmith application? If you don't find my response
helpful, you can request to speak to a human agent
yes I would like a example code for it
how do I install the html2canvas library into appsmith?
Hello! To install the html2canvas library, go to the custom libraries section in
your app, click on the + sign to add a new JS library. In the Library URL
field, enter
https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js and
click Install.
For more information, read our documentation on how to use external
libraries.