How to generate PDFs with Javascript


I have a program in Python that reads a text file (.txt) and with a series of data from the file, generates a PDF with certain information. To read the .txt, use regular expressions. In Javascript there is no problem, I can do it in a similar way to Python, but I can not find any library that generates a PDF so that it can be downloaded by the user of the web.

Someone knows if there is any library in Javascript to generate a downloadable PDF.

asked by kamome 18.12.2015 в 08:55

1 answer


In SOen I've found this question very similar to yours, in She mentions the library jsPDF , I have not tried it yet, but she promises to deliver PDF files with a code as simple as this:

var doc = new jsPDF();
doc.text(20, 20, 'Hello world.');'Test.pdf'); 

I hope you have been served and welcome to SOes.

answered by 18.12.2015 / 09:11