M
M
Mad Coder2021-03-12 19:34:10
HTML
Mad Coder, 2021-03-12 19:34:10

How to do adequate html to pdf conversion in react.js?

The site has a test, after passing which a report is generated. It is necessary to allow the user to download this report in pdf format. I tried jsPDF according to this logic, first I turn the selected block into a picture and then it into pdf. However, there are problems with 2 pages, and proportions. Can anyone suggest a proper way to do this. Thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kovalsky, 2021-03-12
@polyak-y

html2pdf

W
WbICHA, 2021-03-12
@WblCHA

The best and most trouble-free PDF is obtained in puppeteer, but it is only for backing and eats a lot of resources for generation. But due to the fact that it is on Chromium, I personally did not encounter any incomprehensible visual artifacts, either on the page or in PDF.
At the front, I didn’t generate a pdf, but creating an image from html, and it in pdf is a rather strange undertaking, since there are html → pdf generators. I won’t tell you which one to use best, but there are enough popular ones, try everyone.
I will note as a bonus @media printfor specifying styles when printing. However, this is true for printing by means of a browser and a Pupiter.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question