-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Allow using Firefox / WebDriver BiDi protocol during conversion #597
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memo
}) | ||
|
||
try { | ||
await page.emulateMediaType('print') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebDriver BiDi does not yet support media type emulation, but it's OK because using bare
template, that is almost compatible with the print media, whenever converting to image(s).
return await sharp()(buf) | ||
.jpeg({ mozjpeg: true, quality: opts.quality }) | ||
.toBuffer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sharp
to convert PNG to JPG because WebDriver Bidi does only support PNG screenshot.
- ToDo
- Check compatibility with the standalone binary
this._firefoxPDFConversionWarning = true | ||
|
||
warn( | ||
'Using Firefox to convert Markdown to PDF: The output may include some incompatible renderings compared to the PDF generated by Chrome.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, PDF conversion by Firefox has some incompatible rendeings compared to PDF generated by Chrome. e.g. There are some vanished elements in PDF, such as the background gradient like gaia
theme, the element with CSS filter, etc.
➡️ Should treat PDF conversion backed by Firefox as fallback
return await page.screenshot({ | ||
clip, | ||
quality: opts.quality, | ||
type: 'jpeg', | ||
omitBackground: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only supported by CDP. WebDriver BiDi will not work #555.
…one binary Baking the compatible ICU data with the Node binary.
…peteer implementations
|
||
// Ensure the data directory is created | ||
await fs.promises.mkdir( | ||
requiredResolveWSLPath ? resolveWSLPathToGuestSync(dataDir) : dataDir, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check resolveWSLPathToGuestSync
is working on WSL1 environment
Related: #565
Replaces the browser management with new one, implemented in #595. That supports using Firefox, and WebDriver BiDi protocol for Chrome.
This PR will replace only the browser engine. I'm going to work for new options about new browser manager and finders in another pull request.