page.pdf error - 18 page PDF
See original GitHub issueTell us about your environment:
- Puppeteer version: 1.4.0
- Platform / OS version: Ubuntu 16.04.4 LTS
- URLs (if applicable):
- http://snapper2.webcmstools.com/test
- http://snapper2.webcmstools.com/pdf?url=http://pms.dasaproperties.com
- http://snapper2.webcmstools.com/pdf?url=http://pms.dasaproperties.com/test-owner-statement.html
- http://snapper2.webcmstools.com/simple-pdf?url=http://pms.dasaproperties.com
- http://snapper2.webcmstools.com/simple-pdf?url=http://pms.dasaproperties.com/test-owner-statement.html
- Node.js version: v8.11.2
This works fine for smaller PDFs / pages, but fails, pretty consistently, for an 18-page PDF (statement report). It is relatively small considering the amount of pages (about 88KB). I was able to get it to work once, but have not been able to replicate this success.
What steps will reproduce the problem?
Various versions of the following
/test
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('http://pms.dasaproperties.com/test-owner-statement.html', { waitUntil: 'networkidle2' })
const doc = await page.pdf({path: '/tmp/random-page.pdf', landscape: false, format: 'letter', printBackground: true})
await browser.close()
return h.file('/tmp/random-page.pdf').vary('x-magic');
-or-
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('http://pms.dasaproperties.com/test-owner-statement.html', { waitUntil: 'networkidle2' })
const doc = await page.pdf({landscape: false, format: 'letter', printBackground: true})
await browser.close()
return h.response(doc).type('application/pdf')
What is the expected result?
A resulting PDF. Like the following using PhantomJS: http://snapper.webcmstools.com/pdf?url=http://pms.dasaproperties.com/test-owner-statement.html
What happens instead?
The following errors:
May 21 21:11:59 snapper[14335]: { Error: Protocol error (Page.printToPDF): Target closed. May 21 21:11:59 snapper[14335]: at Promise (/srv/snapper/node_modules/puppeteer/lib/Connection.js:200:56) May 21 21:11:59 snapper[14335]: at new Promise (<anonymous>) May 21 21:11:59 snapper[14335]: at CDPSession.send (/srv/snapper/node_modules/puppeteer/lib/Connection.js:199:12) May 21 21:11:59 snapper[14335]: at Page.pdf (/srv/snapper/node_modules/puppeteer/lib/Page.js:798:39) May 21 21:11:59 snapper[14335]: at handler (/srv/snapper/src/screenshots.js:35:34) May 21 21:11:59 snapper[14335]: at <anonymous> May 21 21:11:59 snapper[14335]: at process._tickCallback (internal/process/next_tick.js:188:7) message: ‘Protocol error (Page.printToPDF): Target closed.’ }
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
Closing this. We figured out what was causing the problem, and it had nothing to do with the fact that the PDF was 18 pages long. I will open a new issue if necessary. Thanks!
@mtwhelan do you have any more information? I’m experiencing the same issue.