KnpLabs / snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage
https://knplabs.com
MIT License
4.38k stars 434 forks source link

Terminate called after throwing an instance of 'std::bad_alloc' #226

Closed teufelmartin closed 7 years ago

teufelmartin commented 8 years ago

Hi, i'm running in this issue on generating lager pdf, e.g. 180 pages. But this error is thrown after a few seconds, so it's not a timeout issue.

This is my command: wkhtmltopdf --dpi '72' --image-dpi '72' --image-quality '100' --margin-bottom '1.55cm' --margin-left '0cm' --margin-right '0cm' --margin-top '3.5cm' --page-height '22.5cm' --page-width '21cm' --no-pdf-compression --no-outline --enable-javascript --enable-local-file-access --print-media-type --user-style-sheet 'pdf.css' --footer-html 'footer.html' --header-html 'header.html' '/tmp/knp_snappy57c559de564251.08236260.html' 'test.pdf'

And this is my console output:

Loading pages (1/6)
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

Maybe someone has the same error or any idea how to solve this issue?

akerouanton commented 7 years ago

This looks like a wrong memory allocation. It might have two causes, either:

You should check if your memory consumption and if it's normal, you should ask for help on wkhtmltopdf repo.

I close this issue because it's not related to snappy.