Replies: 4 comments 1 reply
-
This is probably caused by the high values you pass. Try with lower values of a smaller metric. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick response. You're right. But shouldn't' it be the same output?
In my first example, I wrote |
Beta Was this translation helpful? Give feedback.
-
It seems that this is caused by something inside of Chromium. I'd appreciate a PR that throw an exception earlier when too big values are passed. |
Beta Was this translation helpful? Give feedback.
-
That's embarrassing! 200 mm are not 2cm. 🤦♂️ However, an exception should be thrown when the margin is greater than the width. I thought it would be a one-liner, but different metrics need to be considered. I will take a look. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What happened?
When I set
margins(300, 200, 200, 200, 'cm')
the following error messages will be produced. Without margin everything works fine.The command "PATH=$PATH:/usr/local/bin:/opt/homebrew/bin NODE_PATH=`npm root -g` node '/Users/sam/code/laravel-pdf/vendor/spatie/browsershot/src/../bin/browser.cjs' '{"url":"file:\/\/\/var\/tmp\/1185728813-0979418001706015855\/index.html","action":"pdf","options":{"args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"margin":{"top":"300cm","right":"200cm","bottom":"200cm","left":"200cm"},"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /Users/sam/code/laravel-pdf/public Output: ================ Error Output: ================ �[1m�[43m�[30m Puppeteer old Headless deprecation warning:�[0m�[33m In the near future `headless: true` will default to the new Headless mode for Chrome instead of the old Headless implementation. For more information, please see https://developer.chrome.com/articles/new-headless/. Consider opting in early by passing `headless: "new"` to `puppeteer.launch()` If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.�[0m ProtocolError: Protocol error (Page.printToPDF): invalid print parameters: content area is empty at <instance_members_initializer> (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:86:14) at new Callback (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:90:16) at CallbackRegistry.create (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/common/CallbackRegistry.js:22:26) at Connection._rawSend (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Connection.js:80:26) at CdpCDPSession.send (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/CDPSession.js:66:33) at CdpPage.createPDFStream (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:823:63) at CdpPage.pdf (/Users/sam/code/laravel-pdf/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Page.js:850:37) at getOutput (/Users/sam/code/laravel-pdf/vendor/spatie/browsershot/bin/browser.cjs:50:43) at callChrome (/Users/sam/code/laravel-pdf/vendor/spatie/browsershot/bin/browser.cjs:385:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
How to reproduce the bug
Package Version
1.1.2
PHP Version
8.2.12
Laravel Version
10.41.0
Which operating systems does with happen with?
No response
Notes
No response
Beta Was this translation helpful? Give feedback.
All reactions