Method: HexaPDF::Content::Canvas#composer
- Defined in:
- lib/hexapdf/content/canvas.rb
#composer(margin: 0) {|composer| ... } ⇒ Object
:call-seq:
canvas.composer(margin: 0) {|composer| block } -> composer
Creates a CanvasComposer object for composing content using high-level document layout features, yields it, if a block is given, and returns it.
The margin can be any value allowed by HexaPDF::Layout::Style::Quad#set and defines the margin that should not be used during composition. For the remaining area of the canvas a frame object will be created.
Examples:
#>pdf
canvas.composer(margin: [10, 30]) do |composer|
composer.image(machu_picchu, height: 30, position: :float)
composer.lorem_ipsum(position: :flow)
end
See: CanvasComposer, HexaPDF::Document::Layout
2597 2598 2599 2600 2601 |
# File 'lib/hexapdf/content/canvas.rb', line 2597 def composer(margin: 0) composer = CanvasComposer.new(self, margin: margin) yield(composer) if block_given? composer end |