Skip to content

Commit

Permalink
Merge pull request prawnpdf#292 from nathancolgate/master
Browse files Browse the repository at this point in the history
added ability to scale background image
  • Loading branch information
bradediger committed Oct 30, 2012
2 parents 5b84760 + bee443d commit a40418b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/prawn/document.rb
Expand Up @@ -137,6 +137,7 @@ def self.generate(filename,options={},&block)
# <tt>:compress</tt>:: Compresses content streams before rendering them [false]
# <tt>:optimize_objects</tt>:: Reduce number of PDF objects in output, at expense of render time [false]
# <tt>:background</tt>:: An image path to be used as background on all pages [nil]
# <tt>:background_scale</tt>:: Backgound image scale [1] [nil]
# <tt>:info</tt>:: Generic hash allowing for custom metadata properties [nil]
# <tt>:template</tt>:: The path to an existing PDF file to use as a template [nil]
#
Expand Down Expand Up @@ -186,6 +187,7 @@ def initialize(options={},&block)
min_version(state.store.min_version) if state.store.min_version

@background = options[:background]
@background_scale = options[:background_scale] || 1
@font_size = 12

@bounding_box = nil
Expand Down Expand Up @@ -278,7 +280,7 @@ def start_new_page(options = {})
state.insert_page(state.page, @page_number)
@page_number += 1

canvas { image(@background, :at => bounds.top_left) } if @background
canvas { image(@background, :scale => @background_scale, :at => bounds.top_left) } if @background
@y = @bounding_box.absolute_top

float do
Expand Down

0 comments on commit a40418b

Please sign in to comment.