用于 PDF 生成的虾宝石,如果使用 A4 页面大小,则空间不足.轨道 3.2.8.



>我有一个继承虾的 ExportPdf 类 :: 像这样的文档 -

class ExportPdf < Prawn::Document
  def initialize(vehicles, view, page, *args)
   super({:top_margin => 70, :page_size => 'A1'}) 
   @view = view
   @page = page

   file_heading
   table_data
 end
 def table_data
  move_down 30
    table table_data_rows do
    row(0).font_style = :bold
    self.row_colors = ["DDDDDD", "FFFFFF"]
    self.header = true
  end
But I have atleast 20 table columns and the only way to accommodate is by increasing page size as,    
     :page_size => 'A1'.

但这将使它无法打印,因为以 A4 布局打印将不再可能。如何减小字体大小或其他内容以容纳所有 20 个表格列并能够以 A4 布局打印它?

您可能可以使用/添加cell_style

例:

:cell_style => { :size => 10,:border_color => "FFFFFF",:text_color => "333333", :padding => 0, :inline_format => true}
更改大小

值以更改表格文本的字体大小。

最新更新