marp-cli icon indicating copy to clipboard operation
marp-cli copied to clipboard

Experiment: File conversions using Firefox through WebDriver BiDi

Open yhatt opened this issue 2 years ago • 0 comments

Background

Mozilla and Google have announced that Puppeteer now supports WebDriver BiDi protocol. The headless Firefox could not generate PDF for a long time. But now, Firefox becomes able to generate PDF through WebDriver BiDi (Since Firefox 112: https://bugzil.la/1806810)

The support for other functions Marp CLI is depending is still in progress, but that is well worth to try to support PDF/PPTX/image conversion using Firefox.

Most Linux distributions have installed Firefox as a default browser. If implemented the auto-detection of Firefox binary path, Linux users may no longer have to worry about installed browsers. It's important because Marp ecosystem should be easy to touch for everyone.

Related pages

  • https://hacks.mozilla.org/2023/12/puppeteer-webdriver-bidi/
  • https://developer.chrome.com/blog/puppeteer-webdriver-bidi-2023
  • https://pptr.dev/webdriver-bidi

Related issues

  • https://github.com/marp-team/marp-vscode/issues/370

Concerns

  • Currently Firefox does not support Page.pdf({ preferCSSPageSize: true }). Marp CLI conversion logic has to set the proper width and height instead of relying on Marpit's printable option.
  • Firefox emits only PNG file even if used page.screenshot with type option as another file type.

yhatt avatar Dec 19 '23 17:12 yhatt