Skip to content

Instantly share code, notes, and snippets.

@jurv
Created February 9, 2017 10:08

Revisions

  1. jurv created this gist Feb 9, 2017.
    17 changes: 17 additions & 0 deletions wkhtmltopdf.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    wget --save-cookies cookies.txt --keep-session-cookies http://my-site.dev/app_dev.php/my/page

    # It's possible to add option "--post-data 'user=foo&password=bar' " if you need to
    # log in for exemple
    # Then retrieve the session ID in cookie.txt

    vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 \
    --cookie 'sessionid' 'gfou6ks1lsguuvtk9il2v169n7' \
    --cookie 'PHPSESSID' 'gfou6ks1lsguuvtk9il2v169n7' \
    --debug-javascript \
    --load-error-handling ignore \
    --post myform[item][size] xl \
    --post myform[item][color] black \
    --post myform[item][quantity] 1 \
    --post myform[_token] 2O-7Y9_jY6v46dunWno9vdaXJZw5hDiBdudiOegiCa8 \
    http://my-site.dev/app_dev.php/my/second/page \
    test.pdf