added ability to scale background image #292

merged 1 commit into from Oct 30, 2012


None yet

4 participants


Back in February github user augusto came up with a simple way to scale the background image on the PDFs:


It allows us to have a high-resolution background for print materials or a low resolution background for other uses.

We've been successfully using his branch in production for six months, but would love to have this be part of the master, so we can take advantage of the 1.0 release coming up. I'm submitting this pull request because I didn't see any requests from augusto.

Thanks for your consideration.


Here is a code sample from our app:

pdf =
  :background => piece.background_image, 
  :background_scale => (72.0/piece.dpi),
  :left_margin => 0, 
  :right_margin => 0, 
  :top_margin => 0, 
  :bottom_margin => 0, 
  :page_size => [(piece.width_in_pixels + 2*piece.bleed_in_pixels).to_i,(piece.height_in_pixels + 2*piece.bleed_in_pixels).to_i]

Prawn really needs this!


Prawn got 3 pull requests merged today but 292 ain't one. :-)

Just kidding. Thanks for all your hard work, bradediger.



@bradediger bradediger merged commit a40418b into prawnpdf:master Oct 30, 2012
prawnpdf member

Merged, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment