16 votes

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.

12voto

Henry Rodriguez Points 447

In SOen I have found this question very similar to yours, in it the jsPDF library is mentioned, I have not tried it yet, but it promises to deliver PDF files with a code as simple as this one:

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

I hope I have served you and welcome to SOes.

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X