Module: Prawn::Images
- Included in:
- Document
- Defined in:
- lib/prawn/images.rb,
lib/prawn/images/jpg.rb,
lib/prawn/images/png.rb,
lib/prawn/images/image.rb
Overview
rubocop: disable Style/Documentation
Defined Under Namespace
Stable API collapse
-
#image(file, options = {}) ⇒ Prawn::Images::Image
Add the image at
file
to the current page.
Instance Method Details
#image(file, options = {}) ⇒ Prawn::Images::Image
Add the image at file
to the current page. Currently only JPG and
PNG files are supported. (Note that processing PNG images with alpha
channels can be processor and memory intensive.)
If only one of :width
or :height
are provided, the image will be
scaled proportionally. When both are provided, the image will be stretched
to fit the dimensions without maintaining the aspect ratio.
Source Code
lib/prawn/images.rb, line 56
56 | def image(file, options = {}) |
57 | Prawn.verify_options( |
58 | %i[at position vposition height width scale fit], |
59 | options, |
60 | )
|
61 | |
62 | pdf_obj, info = build_image_object(file) |
63 | embed_image(pdf_obj, info, options) |
64 | |
65 | info
|
66 | end
|