Class: Pdf::Components::Logo

Inherits:
Pdf::Component show all
Defined in:
lib/pdf/components/logo.rb

Instance Attribute Summary

Attributes inherited from Pdf::Component

#pdf

Instance Method Summary collapse

Methods inherited from Pdf::Component

#initialize

Constructor Details

This class inherits a constructor from Pdf::Component

Instance Method Details

#render(path, width: 120, height: nil, **_options) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/pdf/components/logo.rb', line 6

def render(path, width: 120, height: nil, **_options)
  raise Pdf::FileNotFoundError, "Logo not found: #{path}" unless File.exist?(path)

  opts = { width: width }
  opts[:height] = height if height
  @pdf.image path, **opts
end