- Improved docs on header/footer templates saying that external URLs don't work.
- Added a logger call when we receive the
Inspector.targetCrashed
message, so users can tell that their Chrome target has died for some reason.
- Documentation updates (@kianmeng)
- Relaxed telemetry dependency to avoid blocking dependency update (@leandrocp)
- Add chromium path on macOS when installed via homebrew (@shamanime)
- Improved error message when Chrome dies at startup.
- Improved docs on the
no_sandbox
option.
- Added
chrome_executable
option to allow specifying path to chrome executable.
- Added
evaluate
option to run client-side scripts before printing. - Added a few options (
evaluate
,set_cookie
,wait_for
) tocapture_screenshot/2
.
- Reimplemented
wait_for
option based on a JS script and theevaluate
option to overcome race condition issues of original solution. Behaviour remains the same.
- Enforced telemetry version 0.4.2 (fixes #108)
- To determine the session pool / ghostscript pool size, if not specified in the options, we now fetch the number of schedulers at runtime, not compile time. Makes more sense. We also set a minimum of 1 in case there is only 1 scheduler online.
- Added option
wait_for
to wait for DOM element attribute to be set dynamically. (@jarimatti) - New global
timeout
option for session pool allows to configure timeout of print processes. - New global
ignore_certificate_errors
option allows to bypass SSL certificate verification. - New global
chrome_args
option allows to pass custom flags to chrome command.
- When sending HTML to Chrome with
{:html, <content>}
, wait for thePage.loadEventFired
notification to allow external resources (images, scripts, ...) to be fetched. (#80)
- Reverted to file descriptor redirection to mitigate weird Port behaviour (#76).
- Elixir version housekeeping. Fixed a warning on Elixir 1.11 by adding
:eex
to:extra_applications
. ChromicPDF now requires Elixir >= 1.10 for its use ofApplication.compile_env/3
. - Dropped
poolboy
in favour ofnimble_pool
. This renders themax_overflow
poolboy option without effect. - Made "online mode" the default. Chrome will resolve all URL references unless the global
option
offline: false
is set.
- Added telemetry events for the PDF generation & PDF/A conversion.
- "On Demand" mode allows to start & stop Chrome as needed, much like puppeteer does. This helps in development to prevent leaving behind zombie processes when the BEAM is aborted with Ctrl+C.
- New global option
discard_stderr
allows to enable Chrome's stderr logging which is by default piped to/dev/null
.
- Graceful shutdown is now actually graceful in that it waits for Chrome to clean up the debugging sessions and close the pipe on its end.
- Moved static files required for PDF/A generation to /priv so they are embedded into releases.
- Moved logo files out of /priv so they are not included in releases.
- Fixed typespecs for
Template.source_and_options/1
.[content_option]
weren't allowed as call tostyles/1
narrowed type to[style_option]
. - Added missing keys to
style_option
.
- Removed the
:width
and:height
options fromTemplate.styles/1
andTemplate.source_and_options/1
as it turns out that Chrome does not pay attention to@page
dimensions and instead still sets the size of the produced PDF to US letter. Since it does not seem possible to the PDF size in Chrome headless besides using thepaperWidth
andpaperHeight
options, moved to a:size
option instead that accepts names like:a4
,:us_letter
, and tuples of{<width>, <height>}
in inches. These are then passed topaperWidth
andpaperHeight
. - Ditched the
preferCssPageSize
option fromTemplate.source_and_options/1
as it did not seem to have any effect. See above.
- Added
zoom: 0.75
to both#header
and#footer
in the template as this seems to be exactly what is needed to reverse the viewport scaling that Chrome uses on them by default. With this, headers & footers and the content can use the same CSS styles. - Included
-webkit-print-color-adjust: exact
rule to template sobackground-color
rules are enabled by default.
- Make
print_to_pdfa/2
actually acceptsource_and_options()
map fromTemplate
.
- Allow
{:url, <path>}
input tuples where path is only a path, and not afile://
URL.
- When passing a function to the
:output
parameter, the function result will now be returned as part of theprint_to_pdf
& friends result as{:ok, <callback_result>}
instead of:ok
.
- Handle
{:safe, iolist()}
tuples in API and Template (for content coming from Phoenix.View). ExposeTemplate.html_concat
as potentially useful helper. - Reset navigation history after each print job to avoid leaking information.
- Create new empty browser context for each target (similar to incognito tab).
- Restart browser target after a maximum number of PDFs have been printed to avoid memory bloat.
- Set user agent to custom string.
- Default number of sessions in pool to half the number of available cores.
- HTML source and header and footer template accept iolists now
- New
Template
module contains basic CSS skeleton to easily dimension & layout pages (header & footer margins)
- Add
set_cookie
option toprint_to_pdf/2
. - Targets now navigate to
about:blank
after PDF prints. - Fixed the temporary file yielding way of calling
print_to_pdf/2
.
- First release to hex.pm