diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-03-25 19:14:04 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-03-25 19:14:04 -0300 |
commit | 567c3ea429d7d4f02ff8bff51f0a540dbcb8aed0 (patch) | |
tree | 2491e16826370b8cc5dd1349c914b1e7e5e14ce7 /lib/httracker/functions | |
parent | 0c025d8c41eb3271b6fabda8c4dd6c8f3d2fa33d (diff) | |
download | httruta-567c3ea429d7d4f02ff8bff51f0a540dbcb8aed0.tar.gz httruta-567c3ea429d7d4f02ff8bff51f0a540dbcb8aed0.tar.bz2 |
Enhance PDF output support
Diffstat (limited to 'lib/httracker/functions')
-rw-r--r-- | lib/httracker/functions | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/httracker/functions b/lib/httracker/functions index ce3dd29..36286d5 100644 --- a/lib/httracker/functions +++ b/lib/httracker/functions @@ -67,13 +67,24 @@ function httracker_get { fi # Get a screenshot - if [ "$WEBKIT2PNG" == "1" ]; then - $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url" + # https://github.com/paulhammond/webkit2png/ + # https://github.com/adamn/python-webkit2png + # https://snippets.aktagon.com/snippets/504-how-to-generate-screenshots-on-debian-linux-with-python-webkit2png + if [ "$WEBKIT2PNG" == "1" ] && which xvfb-run &> /dev/null; then + xvfb-run -a $DIRNAME/webkit2png/webkit2png/webkit2png.py -o $TARGET/screenshot.png "$url" fi # Build a PDF - if [ "$WKHTMLTOPDF" == "1" ] && which wkhtmltopdf &> /dev/null; then - wkhtmltopdf "$url" $TARGET/screenshot.pdf + if [ "$WKHTMLTOPDF" == "1" ] && which xvfb-run &> /dev/null && which wkhtmltopdf &> /dev/null; then + xvfb-run -a wkhtmltopdf "$url" $TARGET/screenshot.pdf + fi + + # See https://www.insecure.ws/linux/serverless_screenshot.html + # http://gfdsa.gfdsa.org/2012/08/15/making-web-pages-screenshots-with-webkit2png-flash-included/ + if [ ! -d "$TARGET/screenshot.pdf" ]; then + if [ "$WEBKIT2PDF" == "1" ] && which xvfb-run &> /dev/null && which webkit2pdf &> /dev/null; then + ( cd $TARGET && xvfb-run -a webkit2pdf "$url" && mv 0000.pdf screenshot.pdf ) + fi fi # Fix permissions again |