gotenberg-ruby icon indicating copy to clipboard operation
gotenberg-ruby copied to clipboard

Extend with Screenshot

Open patricklehmann opened this issue 5 months ago • 1 comments

Hi there,

I wanted to use the screenshot capabilities of gotenberg and added a quickfix on my side. Something like that would be really cool to use? We would have to add some helper methods in the Gotenberg::Chromium::Chromium.

what do you think?

module Gotenberg
  class Chromium::Screenshot < Gotenberg::Chromium
    def call
      backtrace if html_debug?
      transform

      self
    end

    def transform
      properties['width'] = '720'
      properties['format'] = 'webp'

      @response = client.adapter.post('/forms/chromium/screenshot/url', properties.merge(files: files), headers).body
    rescue StandardError => e
      @exception = Gotenberg::TransformError.new(e)
    end
  end
end

patricklehmann avatar Aug 07 '25 09:08 patricklehmann

Hi! Thanks a lot for the idea! I can’t give you any estimates for implementation right now, but I’ll keep as possible feature in mind.

sanzstez avatar Aug 07 '25 14:08 sanzstez