Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I set margins in Prawn in ruby?

This is what I have so far, but I need to set margins:

def send_fax 
    contact = Contact.find_by_id(self.contact_id)

    pdf = Prawn::Document.new
    pdf.font "Times-Roman"
    pdf.move_down(20)
    pdf.text "ATTN: #{contact.first_name} #{contact.last_name}", :size => , :style => :bold
    pdf.text "RE: #{self.subject}"
    pdf.move_down(20)

    pdf.text "#{self.body}"

    OutboundMailer.deliver_fax_email(contact, self, pdf)

  end
like image 623
Satchel Avatar asked Jan 05 '11 01:01

Satchel


1 Answers

Prawn::Document.new( :margin => [0,0,0,0] )

:margin:    Sets the margin on all sides in points [0.5 inch]
:left_margin:   Sets the left margin in points [0.5 inch]
:right_margin:  Sets the right margin in points [0.5 inch]
:top_margin:    Sets the top margin in points [0.5 inch]
:bottom_margin: Sets the bottom margin in points [0.5 inch]

http://rdoc.info/github/sandal/prawn/master/Prawn/Document

like image 178
George Anderson Avatar answered Sep 20 '22 07:09

George Anderson