Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Protocol error (Page.printToPDF) - When headless=false #8158

Closed
JavaScriptDude opened this issue Mar 23, 2022 · 3 comments
Closed

[Bug]: Protocol error (Page.printToPDF) - When headless=false #8158

JavaScriptDude opened this issue Mar 23, 2022 · 3 comments
Labels

Comments

@JavaScriptDude
Copy link

JavaScriptDude commented Mar 23, 2022

Bug description

Steps to reproduce the problem:

  1. Get fully updated Ubuntu 20.04.4 LTS (kernel: 5.13.0-37-generic)
  2. Follow latest instructions for Puppeteer to install
  3. Run simple PDF generating example with headless=false
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({headless: false});
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.pdf({ path: 'example.pdf' });

  await browser.close();
})();

Fails at page.pdf(...) with ProtocolError: Protocol error (Page.printToPDF): Printing is not available.

Puppeteer version

13.5.1

Node.js version

17.0.1

npm version

17.0.1

What operating system are you seeing the problem on?

Linux

Relevant log output

/dpool/vcmain/dev/js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230
                error: new Errors_js_1.ProtocolError(),
                       ^

ProtocolError: Protocol error (Page.printToPDF): Printing is not available
    at /dpool/vcmain/dev/js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:230:24
    at new Promise (<anonymous>)
    at CDPSession.send (/dpool/vcmain/dev/js/node_modules/puppeteer/lib/cjs/puppeteer/common/Connection.js:226:16)
    at Page.createPDFStream (/dpool/vcmain/dev/js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2074:50)
    at Page.pdf (/dpool/vcmain/dev/js/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2103:37)
    at /dpool/vcmain/dev/js/puppeteer/pdf_test/example.js:7:14
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  originalMessage: 'Printing is not available'
}
@JavaScriptDude
Copy link
Author

I tried un-installing and re-installing puppeteer, Tried clearing ~/.config/chromium/ and ~/.cache/chromium/ with no luck.

@JavaScriptDude
Copy link
Author

I suspect this is something on my system specifically and related to chromium but I cannot figure out what the issue is and was hoping if someone on this project may be able to give me some troubleshooting hints.

@JavaScriptDude JavaScriptDude changed the title [Bug]: Protocol error (Page.printToPDF): Printing is not available [Bug]: Protocol error (Page.printToPDF) - When headless=false Mar 23, 2022
@JavaScriptDude
Copy link
Author

This issue is clearly related to Chromium and has existed for some time. I have raised a ticket with Chromium.org.

The resolution for the time being is to run with headless: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant