2016-02-18 49 views
3

我有一个使用gem'wicked_pdf'创建PDF的Rails 3应用程序。Wicked PDF字体大小

我有一个看起来很好的在线HTML页面。但是,当它变成pdf时,字体太大了。

这里是我的控制器代码:

def invoice_pdf 
    @invoice = Invoice.find(params[:invoice_id]) 
    respond_to do |format| 
     format.html # index.html.erb 
     format.pdf do 
     render pdf: "invoice.pdf", 
       font_size: 8, 
       disable_links: true, 
       template: 'invoices/_invoice_pdf.html.erb' 
     end 
    end 
    end 

font_size: 8似乎并没有工作。我可以将其更改为任何值,并且PDF文本看起来相同。

回答

2
body { 
    font-family: 'OpenSansRegular'; 
    font-size: 8px; 
} 

将此css添加到您的html.erb文件中。

+0

谢谢 - 这工作 – Reddirt