Pdf generator/export

I am looking for an solution that will allow me to export a div to pdf that is built with databindings…

I use TCPDF for the creation of dynamic invoices. I have not tried using databindings, but, theoretcally, this should not be a problem.

Have a look at https://www.youtube.com/watch?v=R32LF_pONNY or Google the subject.

1 Like

You can use wkhtmltopdf for that

Most OS have a Print to PDF option, so you would only need a separate css for print. If you would like to generate a PDF on the server and let the user download that, there are several open source libraries that can generate those, but you can’t use databindings with that.

1 Like

We have come across a fantastic solution for generating PDF’s. Output can be styled with CSS, template structures, page breaks, page numbering and header text/logos can all be customised. Simple library all in JS. Free no watermarking, no nonsense, straight PDF exports!

Part of the Kendo UI: https://www.telerik.com/kendo-ui

Example and parent site:
https://demos.telerik.com/kendo-ui/pdf-export/index

Quick tutorial:

Further example:
http://dojo.telerik.com/otugA

In the past we have had to build our PDFs specifying x and y coordinates for placement of content, which can get rather messy so we had to find a solution, and this component answered all our requirements.

Hope it helps anybody looking to do the same!

5 Likes

Hi @George, @patrick & @Teodor,

is there any chance of a realization of this request?

Would the NodeJS implementation make this easier?

I‘m very interested in a serverside solution within Wappler without using an external API.

6 Likes

I think it would be cool to have a pdf builder integrated into Wappler.

10 Likes

Looking forward to having this feature in Wappler.

3 Likes

Hi Dave,

I came across this post when searching for a way to generate / export PDFs on a website. Thank you for the recommendation.

Based on the Kendo demo, I have been able to create an html and download the generated PDF on a test webpage. The PDF generation and download work as expected on the desktop, however, a PDF document can’t be downloaded on a mobile device with Kendo.

Have you been able to generate and download a PDF on mobile devices with Kendo?

I use html2pdf.fr and it works well both desktop and mobile, but would much prefer a native Wappler PDF generator :smile:

4 Likes

Thanks for the recommendation. Yes, a native Wappler PDF generator will be another great addition to the application :slight_smile:

I tried to download the pdf again on a mobile device and it worked. I had some JS and CSS libraries in the html head tag that were causing the issue.

I have also used this recommendation from @ben to add a button that provides users another option to print / save as a pdf. It is working on all types of devices.

I will be binding components on the PDF to a database. There are a couple of improvements I would like to make in the code:

  1. Dynamically update the Exported file name with a couple of field values from the database - use a variable in the JS function and bind it to fields in the database to always generate a unique pdf filename
  2. Open the PDF automatically on devices after a download has been completed

Could someone please assist me if something similar has been done in their projects?

I have come across an issue when generating and downloading PDFs with Kendo.

The images download correctly if these are included in the html page from a local source (Image Properties -> Src -> local image folder).

However, when I include images in the html page by adding a data src in Dynamic Lazy Load Attribute; the images display correctly in the webpage, but when I click to download the page as a PDF (Kendo PDF Export library), the images are not included in the download.

Has anyone come across this issue with Kendo pdf export?

Yes works fine here but the pad we have in the office has Adobe CC installed on it so not sure if that is making a difference (Adobe Acrobat DC). They save to the download directory on the device. Some style issues occasionally but we seem to have worked around them for now.

We experienced this problem and found no way around it as the full document has to be loaded within the page for images to be displayed.

Hi @Dave,

Thanks for your response.

I decided to go with the window.print function as download PDF functionality was not including images (hosted on a CDN) on the page when downloaded.

After some trial and error, I have been able to write an html code that fits nicely on a single or multiple pages when printing or saving as PDF. This also works well on mobile devices.

2 Likes

Hi @guptast, as mentioned earlier, it is worth looking at html2pdf.fr

This example PDF is auto generated using a mobile phone, it uses png, jpg and svg graphics.

1 Like

Thanks for your response.

I had a look at this PDF generator. My understanding is that this software needs to run PDF generation process on the server. I don’t have a programming background, so, I wanted to work with options that provided me client-side functionality :slightly_smiling_face:

Just bumping this popular feature request as it’s been some time now. If it won’t receive much attention, any recommendations on the best or simplest library to integrate with (rather than api)?

Great library Max!

Thanks Dave. It would be nice to have a server side module, similar to the options available for files. It’s a shame as this request is over 2 years old now and still no news on it potentially becoming a feature

2 Likes

Try this solution for @sid

1 Like