Skip to content

Instantly share code, notes, and snippets.

@kimmykuang
kimmykuang / README.md
Last active March 10, 2016 15:09
Dota简笔画

###利用js获取图片的所有下载链接###

用法:

http://dota.uuu9.com/201309/103609.shtml console中加载上述js代码,然后运行document.cmd,出现如下列表:

wget -O "164.jpg" http://image3.uuu9.com/war3/dota//UploadFiles_5254//201309/201309241501003288284.jpg
wget -O "166.jpg" http://image3.uuu9.com/war3/dota//UploadFiles_5254//201309/201309241501003448385.jpg
wget -O "168.jpg" http://image3.uuu9.com/war3/dota//UploadFiles_5254//201309/201309241501003758486.jpg

wget -O "170.jpg" http://image3.uuu9.com/war3/dota//UploadFiles_5254//201309/201309241501003918587.jpg

Recently I was asked to generate PDF invoices for an online shop. I looked at various PHP PDF generators, but wasn't particularly impressed with any of them.

Then I found (via Stack Overflow) a command-line HTML-to-PDF convertor called wkhtmltopdf, which uses WebKit (the same layout engine as Safari and Google Chrome) and therefore is very accurate.

There is a class for PHP integration on the Wiki, but I found it overly complicated and it uses temp files which aren't necessary. This is the code I wrote instead.

I used Smarty for generating the HTML for the PDF, but you can use any template engine, or pure PHP if you prefer.

Note: I originally tried to install wkhtmltopdf from source, but it's much easier to use the static binary instead.