lucacasonato/deno-puppeteer

`page.pdf()` does not resolve

Closed this issue · 4 comments

  • Deno version: 1.20.5 (release, x86_64-pc-windows-msvc)
  • Platform / OS version: Windows 10.0.25126

When I run the hackernews.ts example –

import puppeteer from 'https://deno.land/x/puppeteer@14.1.1/mod.ts';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://news.ycombinator.com", { waitUntil: "networkidle2" });

console.log('before');
await page.pdf({ path: "hn.pdf", format: "a4" });
console.log('after');

await browser.close();

a file at ./hn.pdf is created, but it appears to be empty, and await page.pdf({ path: './example.pdf' }); never resolves. There are no error message, and the default timeout after 30 seconds also does not occur.

The same code setup does work on my system in NodeJS with Puppeteer v14.1.1 and Chromium 991974, but #4136 in the Puppeteer issues describes something similar, that seems to have been fixed by version 1.13.0.

I reverted to puppeteer@9.0.2 with Chromium 869685, which works now.

If anyone knows what may be causing the PDF issue, please let me know! ^^

Also experiencing the same issue, had to downgrade to 9.0.2. But do keep in mind that jspm.io now crashes in this project returning 500, so I had to apply #58 separately.

@fer22f, what version did you use before downgradeing? I am still not sure what caused the PDF issue I was having in @14.1.1, but the same code example is currently working fine for me in @16.2.0.

I was on 16.2.0, but it had another issue relating to being impossible to extract the PDF using the stream API. I started work on it via https://github.com/fer22f/deno-puppeteer/commit/7df9d6a6fa4605ca25fec47ac0ffc7dff3c6172b, but the PDF generation appeared stuck.