Posts

Showing posts from November, 2019

Convert Markdown Documents to PDF Using md-to-pdf

Image
Convert Markdown Documents to PDF Using md-to-pdf Azure DevOps now has an option to link your Wiki to a repo . With this change I decided to start creating all my documentation in Markdown and then to supply my users with PDF output for things such as user guide. This allows me to source control my documents and still supply users with clean looking outputs. Here is how i went about doing this. Create Documents Folder/Package I started by creating a new folder for my documents and running the npm init command. Install md-to-pdf from NPM Install the md-to-pdf npm package by running npm i --save-dev md-to-pdf Create Index.js file Create a index.js file in the root directory of your folder and copy the following code. const mdToPdf = require('md-to-pdf'); const config = { "pdf_options": { "format": "Letter", "margin": "15mm", "displayHeaderFooter": true, "headerTemplate": "<style>s