mixu / electroshot

Capture website screenshots with optional device and network emulation as jpg, png or pdf (with web fonts!) using Electron / Chrome.
548 stars 34 forks source link

Cannot print CSS background for pdf #29

Open jwhipp opened 5 years ago

jwhipp commented 5 years ago

When I try to set --pdf-background 1 when generating a PDF, I am met with a fail message and the process hangs.

Command Line:

xvfb-run URL 1024 --format pdf --filename "myfile.pdf" --pdf-margin none --pdf-page-size legal --pdf-background 1 --debug

Output:

Electron 1.6.x has reached the end of its support cycle. Developers are encouraged to upgrade their applications to a newer series. Read about newer series at https://electronjs.org/releases . Read about Electron support at https://electronjs.org/docs/tutorial/support#supported-versions . electron debug Setting Chrome flag: pdf-page-size legal electron debug Setting Chrome flag: config /tmp/electroshot-config.json electron debug { url: 'http://crm.stage.kvcore.com/listings/pitch/135/build?key=rjIa0jBuF7orLKbAs3X5V3LTQG0h', delay: 0, selector: '', 'zoom-factor': 1, format: 'pdf', quality: 75, 'user-agent': '', latency: null, download: null, upload: null, css: '', js: '', debug: true, root: '', pdf: { pageSize: 'Legal', marginsType: 1, printBackground: 1, landscape: false }, size: { width: 1024, height: 0 }, out: '/home/ubuntu/electro-1024.pdf' } electron debug IPC window-loaded electron debug SEND ensure-rendered electron debug IPC loaded [ [Function] ] Increasing window size to 1024x1343 electron error Error: Error: Failed to generate PDF

jwhipp commented 5 years ago

Also, then I leave out the --pdf-background, the PDF generates but it's missing the background image specified in the CSS.