Converts pages exported from Notion as Markdown into PDF files using the command line due to browser rendering issues.
Provided by default within the application, Notion's "Export -> Print as PDF" functionality only allows a single page to be printed to PDF at a time. As a result, formatting issues occur in most cases (e.g. multiline code snippets) from the browser attempting to render the markup unsuccessfully.
Markdown Files (ZIP) -> marked -> HTML Files -> wkhtmltoPDF -> PDF Files
The methodology used by this tool is simply to take exported Markdown pages from Notion, individually or in bulk, uncompress the downloaded archive and then process each by first parsing into HTML using
marked and then converting to PDF using
wkhtmltopdf is used instead of other
PhantomJS-based methods which seem to suffer some similar defects (#10373, #10669, #13524) as the browser, even though both are using the QtWebKit rendering engine.
Use your ideal package manager for Node and install globally.
yarn global add notion-md-pdf
npm install notion-md-pdf -g
Call the following shell command with the desired zip archive as the first argument.
notion-md-pdf Export-XXXXXX.zip # Conversion completed: ~/Document-Name-XXXXXX-1.pdf
Supported Operating Systems
Windows (64-bit), Mac OS X (64-bit), and Linux (32-bit) (64-bit) OS are supported.
Based on the version of
wkhtmltopdf that is downloaded from a CDN by the post installation script.
Feel free to submit a pull request at any time.
This project is licensed under the MIT License - see the LICENSE file for details