Skip to content

Extend with Screenshot #10

@patricklehmann

Description

@patricklehmann

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions