Sha256: 40e658352c04fb7685774755649dad55f1e5369db48c98caa5d7ab93e191828e

Contents?: true

Size: 670 Bytes

Versions: 3

Compression:

Stored size: 670 Bytes

Contents

# Pass an image path to the <code>:background</code> option and it will be used
# as the background for all pages.
# This option can only be used on document creation.

require_relative '../example_helper'

filename = File.basename(__FILE__).gsub('.rb', '.pdf')

img = "#{Prawn::DATADIR}/images/letterhead.jpg"

Prawn::Document.generate(filename, background: img, margin: 100) do
  text 'My report caption', size: 18, align: :right

  move_down font.height * 2

  text 'Here is my text explaning this report. ' * 20,
    size: 12, align: :left, leading: 2

  move_down font.height

  text "I'm using a soft background. " * 40,
    size: 12, align: :left, leading: 2
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-2.2.2 manual/document_and_page_options/background.rb
prawn-2.2.1 manual/document_and_page_options/background.rb
prawn-2.2.0 manual/document_and_page_options/background.rb