Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想渲染一些文本,然后是几个单行表。如果我尝试以下操作:
pdf.text "Credit Card Number: " 4.times do pdf.table [Array.new(4, Prawn::Text::NBSP)] pdf.text " " end
...每个元素都以自己的行结束。有没有一种简单的方法可以让它们内联渲染?
只需创建带有子表的表,如下所示:
require 'prawn' Prawn::Document.generate('ccn.pdf') do |pdf| pdf.text "Credit Card Number: " tbl = pdf.make_table([Array.new(4, Prawn::Text::NBSP)]) pdf.table([[ tbl, " ", tbl, " ", tbl, " ", tbl ]], :cell_style => { :borders => []} ) end