【问题标题】:How could I justify text in a text_box in Prawn?我如何证明虾的 text_box 中的文本是合理的?
【发布时间】:2009-12-11 15:44:59
【问题描述】:

有没有办法使用 prawn 插件来证明 pdf.text_box 中的文本?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-plugins prawn


    【解决方案1】:

    这里是 text_box 的文档所在:Class::Prawn::Document

    文本框与大多数其他大虾函数一样,先获取数据,然后再获取选项。

    #text_box(text,options)
    
    pdf.text "Here is some text for this text entry", :size => 16, :align => :left
    

    我认为您需要使用:align 选项。

    Rails Cast 在 Prawn 上做了一集,可能也很有用。看看here

    【讨论】:

    • 实际上是:align => :justify。编辑你的答案会违背你的意图,所以我不会编辑它,但请更新它=)
    猜你喜欢
    • 2023-04-09
    • 2021-07-16
    • 1970-01-01
    • 2014-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多