Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ################
- # Supply 2 arguments: input file (in markdown) and output file (a PDF)
- # If no output file is specified, a file in the name of "a.out" will be created
- #
- # Requires the following to be preinstalled:
- # wkhtmltopdf It can be installed through brew or your OS's package manager
- # markdown_py It can be installed with pip: pip install markdown_py
- ################
- if [ "$#" -eq "0" ]
- then
- echo "No input file specified!"
- exit 1
- fi
- markdown_py "$1" > "temptempmarkdown.html"
- if [ "$#" -eq "1" ]
- then
- wkhtmltopdf "temptempmarkdown.html" "a.pdf"
- else
- wkhtmltopdf "temptempmarkdown.html" "$2"
- fi
- rm "temptempmarkdown.html"
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement