- Add
viewportoption #110
- Fix
timeout_if_open_connectionswhen false - Depend only on
actionpack
- BREAKING CHANGE:
:base_urlhas been removed in favour of:display_url. These aren't the same. The:display_urlis intended to be the address of the page as a browser would normally see it. Relative paths in the:htmlare interpreted in light of this. - BREAKING CHANGE:
ferrum_pdf_inline_stylesheet,ferrum_pdf_inline_javascript, andferrum_pdf_base64_assethave been removed in favour of:display_url.
- Add
page_options,pdf_options, andscreenshot_optionsconfiguration #75 - Retry on
Ferrum::TimeoutErrorwhen loading a page and raise if retries fail #74
-
Replace controller methods with a Rails renderer
This provides a much cleaner and better named Rails integration. You can pass options directly into the
rendermethod which will render the PDF or screenshot and pass it along tosend_datafor you.Before:
class PdfsController < ApplicationController def show respond_to do |format| format.pdf { pdf = render_pdf() send_data pdf, disposition: :inline, filename: "example.pdf" } format.png { screenshot = render_screenshot() send_data screenshot, disposition: :inline, filename: "example.png" } end end end
After:
class PdfsController < ApplicationController def show respond_to do |format| format.pdf { render ferrum_pdf: {}, disposition: :inline, filename: "example.pdf" } format.png { render ferrum_screenshot: {}, disposition: :inline, filename: "example.png" } end end end
-
[Breaking] Remove assets helper config option. This will always be included by default.
- No changes
-
Thread safe browser management #63
-
[Breaking] Remove
add_browserfeature to simplify the gem.You can pass
browserto render methods to use your ownFerrum::BrowserinstanceFerrumPdf.render_pdf(url: "https://example.org", browser: Ferrum::Browser.new)
- Quit browser if a new one is added with the same name
- Safely handle html preprocessing when
base_urlisnil
- Add
FerrumPdf.configureblock for setting default browser options - Restart the browser once if
Ferrum::DeadBrowserErroris raised - Add
FerrumPdf.add_browserto allow registering multiple browsers and referencing them by name
FerrumPdf.add_browser :large, window_size: [1920, 1080]- Add
browser: :nameoption for overriding the default browser
FerrumPdf.render_pdf(url: "https://example.org", browser: :large)
FerrumPdf.render_pdf(url: "https://example.org", browser: Ferrum::Browser.new)-
Simplify HTML preprocessing
- Extract protocol from
base_urlinstead of using a second arg - Remove
protocoloption - Rename
hosttobase_url
- Extract protocol from
-
Add assets helpers to Rails views for dealing with Chrome quirks. https://nathanfriend.com/2019/04/15/pdf-gotchas-with-headless-chrome.html
ferrum_pdf_inline_stylesheet("application.css")
ferrum_pdf_inline_javascript("application.js")
ferrum_pdf_base64_asset("logo.svg")- Add
FerrumPdf.include_controller_module = falseoption to skip addingrender_pdfRails helper - Add
render_screenshot
- Add support for
pdf_options - Add example for displaying header and footer
- Drop need for tempfile
- Relax Rails version requirements
- Initial release