Skip to content

Instantly share code, notes, and snippets.

@Mnkai
Last active October 25, 2017 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mnkai/1a8171502d0e18b1af2159d285358c1e to your computer and use it in GitHub Desktop.
Save Mnkai/1a8171502d0e18b1af2159d285358c1e to your computer and use it in GitHub Desktop.
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