I came across this question before I started writing it and thought I’d come back and let you know 🙂
Example create a “Hello World” PDF file.
// Default export is a4 paper, portrait, using milimeters for units var doc = new jsPDF() doc.text('Hello world!', 10, 10) doc.save('a4.pdf')
The browser support does not appear to be as strong as jsPDF, nor does there seem to be an option for shapes, but the options for formatting text are more advanced then the options currently available in jsPDF.
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.
Another interesting project is texlive.js.
It allows you to compile (La)TeX to PDF in the browser.
You can use this free service by adding a link which creates pdf from any url (e.g. http://www.phys.org):
To get the file to the user, you would want to do a server submit in order to get the browser to bring up the save dialog.
With that said, it really isn’t too hard to generate PDFs. Just read the spec.