adnan360 ba763d97e5 Change bash shebang line to env преди 3 години
..
.gitignore 6f00209c06 Added HTML output преди 4 години
README.md fc68b72464 Added cli parameter support преди 4 години
output.sample.html 6f00209c06 Added HTML output преди 4 години
output.sample.pdf fe4dc6f1f4 Added markdown to pdf conversion example with node.js преди 4 години
run.sh ba763d97e5 Change bash shebang line to env преди 3 години
run.sh-e ba763d97e5 Change bash shebang line to env преди 3 години
run.sh-e-e ba763d97e5 Change bash shebang line to env преди 3 години
style.css fe4dc6f1f4 Added markdown to pdf conversion example with node.js преди 4 години
test.md fe4dc6f1f4 Added markdown to pdf conversion example with node.js преди 4 години
topdf.js fc68b72464 Added cli parameter support преди 4 години

README.md

Markdown to PDF Conversion with html5-to-pdf node.js module

This example converts a Markdown file into HTML code and then to a PDF. This needs internet connection and unfortunately downloads its own copy of chromium inside node_modules dir which is not perfect and not necessarily privacy friendly. But at the moment this the only solution that supports CSS3 columns.

Setup

npm install markdown-to-html --save
npm install html5-to-pdf --save

* If you get Error: html-pdf: Received the exit code '1' on Debian:

export OPENSSL_CONF=/etc/ssl/

Conversion

Just execute run.sh on Linux:

./run.sh

You can also run:

node topdf.js

There are other options to the node command:

--skip-pdf : does not create a PDF file
--skip-html : does not create an HTML file

Example:

# below just creates an HTML file
node topdf.js --skip-pdf