bitcrowd / chromic_pdf

Convenient HTML to PDF/A rendering library for Elixir based on Chrome & Ghostscript
Apache License 2.0
409 stars 37 forks source link

Add new headless mode flag #328

Closed PJUllrich closed 1 month ago

PJUllrich commented 1 month ago

Hey folks,

Chrome introduced a new headless mode with Chrome 112: https://developer.chrome.com/docs/chromium/new-headless

ChromicPDF currently uses the old headless mode because the flag --headless defaults to --headless=old. The problem is that we can't overwrite the default flag with --headless=new because the list of arguments would contain both flags and I'm unsure which flag is ignored.

So, I added a quick option, which enables the mode if set to true. Please let me know what you think about this and feel free to ignore this PR of course if you think it's unnecessary :)

PJUllrich commented 1 month ago

Ah nevermind! I just found the documentation for adding/removing flags. It actually mentions --headless=new, so I'll be using that one. Sorry for the oversight of not finding this earlier.

https://github.com/bitcrowd/chromic_pdf/blob/main/lib/chromic_pdf.ex#L286