This post will show how to convert a markdown app to a PDF file with the Pandoc conversion tool.
Pandoc is an open-source document conversion tool that is used to convert files from one markup format to another.
Pandoc is available for Windows, Mac, and Linux.
Download Links for Pandoc
Using Pandoc, we can convert a markdown file into pdf, Docx, HTML, and many other formats. More details https://pandoc.org/index.html
Here, we will just convert a markdown file to pdf and even see how we can merge two markdown files together.
Convert markdown to PDF with Pandoc
To convert a markdown file (
post.md) to a PDF document, we will use the following command
pandoc -s -o document.pdf post.md
So, this command will generate a PDF document named
document.pdf as an output.
Merge two markdown files into one PDF document using Pandoc
We can also use Pandoc to merge files too. Suppose we have two markdown files:
So to convert it into one PDF document, we will use the command:
pandoc -s -o document.pdf article1.md article2.md
Pandoc will merge and generate the
document.pdf as the output in your directory.
So this is a straightforward way to convert a markdown document to pdf offline using the command line in your Windows, macOS, and Linux operating system.