Generating PDF files with JavaScript

后端 未结 6 1128
悲哀的现实
悲哀的现实 2020-11-22 05:45

I’m trying to convert XML data into PDF files from a web page and I was hoping I could do this entirely within JavaScript. I need to be able to draw text, images and simple

6条回答
  •  灰色年华
    2020-11-22 06:52

    I maintain PDFKit, which also powers pdfmake (already mentioned here). It works in both Node and the browser, and supports a bunch of stuff that other libraries do not:

    • Embedding subsetted fonts, with support for unicode.
    • Lots of advanced text layout stuff (columns, page breaking, full unicode line breaking, basic rich text, etc.).
    • Working on even more font stuff for advanced typography (OpenType/AAT ligatures, contextual substitution, etc.). Coming soon: see the fontkit branch if you're interested.
    • More graphics stuff: gradients, etc.
    • Built with modern tools like browserify and streams. Usable both in the browser and node.

    Check out http://pdfkit.org/ for a full tutorial to see for yourself what PDFKit can do. And for an example of what kinds of documents can be produced, check out the docs as a PDF generated from some Markdown files using PDFKit itself: http://pdfkit.org/docs/guide.pdf.

    You can also try it out interactively in the browser here: http://pdfkit.org/demo/browser.html.

提交回复
热议问题