Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Printing markdown document to thermal printer by command line - depends on pandoc and wkhtmltopdf
#!/usr/bin/zsh
pandoc "$1" -o "/tmp/print_temp_out.html" --wrap=preserve -f markdown -t html -s
wkhtmltopdf --encoding utf-8 --margin-top 1mm --margin-bottom 7mm --margin-left 0mm --margin-right 0mm --page-height 210mm --page-width 47mm --grayscale "/tmp/print_temp_out.html" "/tmp/print_temp_out.pdf"
lp -d Zjiang-58 "/tmp/print_temp_out.pdf"
rm "/tmp/print_temp_out.pdf"
rm "/tmp/print_temp_out.html"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment