Options for background image

158 views
Skip to first unread message

zubin

unread,
Apr 23, 2009, 12:11:38 AM4/23/09
to Prawn
Hi,

I'm generating a PDF with a background image.
The PDF is for print, so the image dpi needs to be 300dpi (or at least
more than 72dpi).

My image is saved with the correct dimensions and dpi, but it gets
scaled up as though it were at 72dpi.
I can't find how to override this behaviour in the docs (using Prawn v
0.4.1).

Here's my code:

Prawn::Document.new(:background => background_image_path) do
text "Some text..."
end.render

Would I be better of using the image method instead? If so, can text
be "floated" over it?

Also, is there any way to specify a non-standard page size?
(ie not included in Document::PageGeometry::SIZES)

Thanks,
Zubin

Gregory Brown

unread,
Apr 23, 2009, 12:30:18 AM4/23/09
to prawn...@googlegroups.com
On Thu, Apr 23, 2009 at 12:11 AM, zubin <zu...@zenlunacy.com> wrote:
>
> Hi,
>
> I'm generating a PDF with a background image.
> The PDF is for print, so the image dpi needs to be 300dpi (or at least
> more than 72dpi).

http://groups.google.com/group/prawn-ruby/search?group=prawn-ruby&q=300+dpi&qt_g=Search+this+group

> Would I be better of using the image method instead? If so, can text
> be "floated" over it?

Maybe. And yes, so long as the text is rendered after the image, you
should be able to overlay
(though I have not tested)

> Also, is there any way to specify a non-standard page size?
> (ie not included in Document::PageGeometry::SIZES)

Yes. just use [width, height] instead of a symbol. (In PDF points 1/72 in)
I should add this to the documentation. Please file an issue at:

http://github.com/sandal/prawn/issues

to remind me.

-greg

--
BOOK: http://rubybestpractices.com
TECH: http://blog.majesticseacreature.com
NON-TECH: http://metametta.blogspot.com

Reply all
Reply to author
Forward
0 new messages