ruby-on-rails – 如何在Prawn中设置ruby的边距?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 如何在Prawn中设置ruby的边距?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我到目前为止,但是我需要设置边距:
  1. def send_fax
  2. contact = Contact.find_by_id(self.contact_id)
  3.  
  4. pdf = Prawn::Document.new
  5. pdf.font "Times-Roman"
  6. pdf.move_down(20)
  7. pdf.text "ATTN: #{contact.first_name} #{contact.last_name}",:size =>,:style => :bold
  8. pdf.text "RE: #{self.subject}"
  9. pdf.move_down(20)
  10.  
  11. pdf.text "#{self.body}"
  12.  
  13. OutboundMailer.deliver_fax_email(contact,self,pdf)
  14.  
  15. end

解决方法

Prawn :: Document.new(:margin => [0,0])
  1. :margin: Sets the margin on all sides in points [0.5 inch]
  2. :left_margin: Sets the left margin in points [0.5 inch]
  3. :right_margin: Sets the right margin in points [0.5 inch]
  4. :top_margin: Sets the top margin in points [0.5 inch]
  5. :bottom_margin: Sets the bottom margin in points [0.5 inch]

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

猜你在找的Ruby相关文章