加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 19:45:29 所属栏目:百科 来源:网络整理
导读:这是我到目前为止,但是我需要设置边距: 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
这是我到目前为止,但是我需要设置边距:
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

解决方法

Prawn :: Document.new(:margin => [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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读