How to create a PDF from Markdown
Various ways to create a PDF from Markdown
The following sections assume that you want to use a script (or within a script) to do the conversion. There are probably other tools out there that can be used at the command-line for doing that as well.
So, if you need to do that, you can call the tool from within the script.
In Python - How to create a PDF from text
Here are some good examples:
- Convert Text and Text File to PDF using Python - good general overview
- Create and Modify PDF Files in Python
- Creating PDFs with PyFPDF and Python - this gives a nice breakdown and example of using the FPDF framework
In Python - How to create a PDF from Markdown
links here:
- md2pdf - small but might be ok
- markdown-to-pdf - seems a little more put together, from the documents, though after looking at it, it's just a script, so it might be something to use or not. Good for an example on how to do it for sure.
- Is there any direct way to generate pdf from markdown file by python - answer I liked was basically this (by JasonFruit) -- I have done and would do it in two steps. First, I'd use python-markdown to make HTML out of my Markdown, and then I'd use xhtml2pdf to make a PDF file.
- Generating a PDF from Markdown or HTML - has some nice examples
command-line tools
- mdpdf - javascript
- How to Convert Markdown to PDF - mentions a few ways. Shows using Pandoc that I wouldn't have thought of, so ...
- A Markdown-to-PDF Workflow on Linux - uses a Makefile, so would be easy to adapt (uses Pandoc)
- Convert files at the command line with Pandoc - Pandoc app/exe
- Markdown to PDF - javascript
- How to convert Markdown to PDF without LaTeX? - has some good suggestions
- Markdown to PDF in MacOSX -- I think that this might be the winner for me personally! Gives good instructions on how to install a working Pandoc and then a script that makes it simpler for creating a PDF document. Saved this in my docs/general directory for future reference.
Other links
- Why all you’ll ever need is Markdown - not necessarily a good way to convert a document for what I was thinking, but an interesting way of doing it -- more a philosophy of never moving away from Markdown.