简体   繁体   中英

Generate PDF and Excel using Javascript (Client side)

Is there a client side Javascript framework similar to jasper report in Java.My requirement is to generate both PDF and Excel at client side(browser) without doing it at server side. I have found that there are javascript libraries like JsPDF and PDFkit to generate PDF and different library for generate Excel which make the development effort much harder.I want some thing exactly similar to what is done by jasper report.Also if it can be added using NPM without manual importing to the code and use it then it is much suitable for my requirement.

i believe jquery datatable comes with all you need check it out https://datatables.net/extensions/buttons/examples/initialisation/export.html

I am afraid you have to use two separate libraries that best fit your needs, one for PDF and another for Excel. If you think about it, it makes sense.

It is a huge undertaking to render PDFs with plain Javascript, just look at the complexity of PDF.js alone. Excel is no different. These are complex formats.

Your use case is to render PDF and Excel. Somebody else might want to render PDF and DOC. You get the idea, there are tons of different formats out there, and there is no single library to handle them all. Even if someone had enough resources to build something like that, it would probably be broken up into modules that you can pick and choose based on your needs. A single framework would be too big to be practical for the web.

Thanx Fadi and Axel for your prompt response.Yes the solution you have mentioned is a good one which is not known by me.There is a limitation in that solution when it is going to be used for my requirement.Refer the following screen shot of the report that I have to generate as PDF and Excel using javascript library.In that report it is not only the data table which need to be included to the document.But also some detail on the top and a logo.Also the application is developed using EmberJS and this jquery table plugin cant be used since we are using the Ember table which cant be replaced by this Jquery table.Is there an alternative solutions except Jquery data table?

在此处输入图像描述

https://jsreport.net , for those still looking, check this out!

Credits: jsreport Author

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM