Prawn - how to fit image to full size of PDF page

45 views
Skip to first unread message

stag...@nycopportunity.nyc.gov

unread,
Nov 7, 2018, 4:00:18 PM11/7/18
to Prawn
I'm currently working using prawn. 

      pdf_prawn = Prawn::Document.new(page_size: 'LETTER')
      pdf_prawn.bounding_box([0, pdf_prawn.cursor], width: 610.00, height: 790.00) do
        pdf_prawn.image format_image, fit: [:width, :height]
      end

I'm currently getting the error `NoMethodError (undefined method `to_f' for :height:Symbol)`

Before I try using 

pdf_prawn.image format_image, fit: [400, 400], position: :center, position: :center

Even though I was able to fill the whole image into the PDF I don't think this is the best solution.

I would like to know how to fit in the PDF the whole file without it being cropped.

Screen Shot 2018-11-07 at 11.41.08 AM.png

Screen Shot 2018-11-07 at 11.00.16 AM.png




from the two images above you can see that the size is not fitting 100 percent I wonder whats the best approach to fit the original file or get close to it.


Reply all
Reply to author
Forward
0 new messages