This is a simple markdown to pdf parser that supports custom CSS stylesheets.
In the future, ezPDF will allow you to preview files and maybe even edit them in the Browser using markdown.
Run
npx ezpdf [filename]
Substituting [filename] for the name of the markdown file you want to print as PDF.
For example:
npx ezpdf mylittlefile
Will produce a file named mylittlefile.pdf
This takes a while (about 20~30 seconds) to run, because npx has to temporarily install the Chromium browser.
If you find yourself using the command repeatedly, you may consider installing the package either globally or locally.
If you find yourself converting the same file, you should consider installing the package locally.
Run
npm install ezpdf
or
yarn add ezpdf
Then, you can use npx
as usual (npx ezpdf [filename]
) to run the package from the local node_modules/bin
, and it will run much faster (under 1s usually).
Alternatively, if you find yourself parsing multiple files over different folders, you may want to install the package globally.
In that case, run
npm install -g ezpdf
or
yarn global add ezpdf
Afterwards, you can run
ezpdf [filename]
awywhere to get the same performance as running from a local installation.
ezPDF runs on 3 steps:
- Converts the markdown file to HTML using an unified pipeline. During this step, it also extracts YAML configuration from the frontmatter to create the stylesheet and append links to the HTML file head;
- Serves the HTML file locally on port 8080 using http-server;
- Navigates to the page using puppeteer and prints the PDF file through its headless Chromium browser.
Afterwards, it cleans up the temp folder created during the process.
Thanks for the interest! Please, read the CONTRIBUTING file
This project uses the classic MIT open-source license, which means you can use anything here for free for any commercial or non-commercial ends, but if you replicate parts of the code, the resulting project must also follow the same license.
It also means this software is provided "as is", with no warranty of any kind.
For more info, read LICENSE.md