Home > Back-end >  NodeJS - Compile markdown into pdf (from a string in memory) and download it on web page
NodeJS - Compile markdown into pdf (from a string in memory) and download it on web page

Time:08-05

I'm developing a web page. I want to create an option to generate a .pdf file and allow the user to download it.

Currently I'm using jsPDF but I'm finding it very hard to properly format the document.

I was hoping to find a new way of building it in markdown format, compile it and then download it.

Is there a way that I can do this, in node.js, where say, I have a string in memory (which is the markdown text format), compile that into a pdf and then download it from the page?

I haven't found any package that really does this, if you know, feel free to just let me know which one can achieve this and I'll figure it out.

CodePudding user response:

For such a thing, I recommend building your .pdf file first a HTML file, so you could edit it easily (hardcoded or dynamicaly) then convert your html file to .pdf file. there is alot of packages to do this

have a closer look on this package https://www.npmjs.com/package/html-pdf-node

  • Related