Markdown to pdf

1.2

介绍

markdown 可以方便地撰写文档,pdf 则便于转发。于是就产生了书写 md, 再转换成 pdf 发送的需求。

方案

  1. pandoc

    .md -> .html
    
  2. wkhtmltopdf

    .html -> .pdf
    

脚本

markdown 转为 pdf/jpg 的脚本。嵌入了 bootstrap 样式。

if [ -z $1 ]
then
  echo "No argument supplied"
else
  pandoc $1  -c "http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" -o $1.html
  D:/program/wkhtmltopdf/bin/wkhtmltopdf.exe $1.html $1.pdf
  D:/program/wkhtmltopdf/bin/wkhtmltoimage.exe $1.html $1.jpg
fi
📖