Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ################
  4. # Supply 2 arguments: input file (in markdown) and output file (a PDF)
  5. # If no output file is specified, a file in the name of "a.out" will be created
  6. #
  7. # Requires the following to be preinstalled:
  8. # wkhtmltopdf It can be installed through brew or your OS's package manager
  9. # markdown_py It can be installed with pip: pip install markdown_py
  10. ################
  11.  
  12. if [ "$#" -eq "0" ]
  13. then
  14. echo "No input file specified!"
  15. exit 1
  16. fi
  17.  
  18. markdown_py "$1" > "temptempmarkdown.html"
  19.  
  20. if [ "$#" -eq "1" ]
  21. then
  22. wkhtmltopdf "temptempmarkdown.html" "a.pdf"
  23.  
  24. else
  25. wkhtmltopdf "temptempmarkdown.html" "$2"
  26. fi
  27.  
  28. rm "temptempmarkdown.html"
  29.  
  30. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement