C
C
Crazy Citizen2020-10-26 14:19:04
JavaScript
Crazy Citizen, 2020-10-26 14:19:04

How to generate PDF in JS?

Hello, I have a question about generating PDF documents. It is necessary to generate a PDF file based on JSON or HTML, I considered 2 options, on the back using puppeteer , and on the front using jsPDF or Print.js , I stick to the option on the back, because there are a lot of documents, and their number is likely to grow, and I don’t really want to drag all the templates to the front, and everything is not very good with the encoding in jsPDF. Actually interests what approach is more correct to use? Maybe there is some option that is not obvious to me?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
salikovpro, 2020-10-26
@Markizzio

From experience I will say that it is better to use full-fledged PDF generation tools than options with automatic html to pdf conversion. I would recommend pdfkit.org

S
Semyon Kuznetsov, 2020-10-26
@zloy_kot_developer

Do you need mass generation?
That is, to generate for some reason, I can’t even imagine why, a hundred pdf. Or is it elementary that some manager would press the download button and a PDF file, for example, with statistics, arrives to him?

M
Maxim, 2020-11-05
@fear-cry

There is another option (on a clean backend): prepare templates in advance in PDF format with all static data (for example, bank details). When downloading is requested, add to the empty fields and give the file. And you don’t have to fool around with PDF generation from scratch, because. Appending data to an existing PDF is an easy operation. They did it on sale.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question