wicked_pdf字体大小太大了

我遇到的问题是渲染的PDF的字体大小在生产中更大 。 在开发过程中生成的PDF看起来很棒。

这是开发的渲染:

在此处输入图像描述

这是生产中的渲染:

在此处输入图像描述

这使我很难为开发中的生产服务器格式化我的文档。 你能看一下吗?

HTML版本: http : //www.hearingtracker.com/tickets/170

PDF下载: http : //www.hearingtracker.com/tickets/170.pdf

这是我的控制器动作:

def show @ticket = Ticket.find(params[:id]) respond_to do |format| format.html { render :layout => false } format.pdf do render :pdf => "HearingTrackerTicket", :layout => false, :dpi => '300' end end end 

这是pdf.css.scss

 .pdf-body { background-color: white; p { font-size: 12pt; line-height: 20.5pt; .underline { border-bottom: 1pt solid; } } h1 { margin-top: 0; font-size: 24pt; } h3 { font-size: 14.25pt; } .code { position: absolute; top: 23pt; right: 20pt; } .header { border-bottom: 1pt solid; } .content { .line { height:30pt; border-bottom: 1pt solid; display:block; } ul { list-style-type: none; height:112pt; li { font-size: 12pt; display: block; float: left; height: 22.5pt; line-height: 17pt; list-style: none; margin-right: 20pt; width:100%; div { display: block; float: left; border:1pt solid; width: 15pt; height: 15pt; margin-right: 10pt; } } } ul.horizontal { height:30pt; li { width:auto; } } ul.horizontal-fixed { height:30pt; li { width:250pt; } } } } 

这是HTML输出(从与PDF相同的源生成):

     .pdf-body{background-color:white}.pdf-body h1{margin-top:0;font-size:24pt}.pdf-body h3{font-size:14.25pt}.pdf-body .code{position:absolute;top:23pt;right:20pt}.pdf-body p{font-size:12pt;line-height:20.5pt}.pdf-body p .underline{border-bottom:1pt solid}.pdf-body .header{border-bottom:1pt solid}.pdf-body .content .line{height:30pt;border-bottom:1pt solid;display:block}.pdf-body .content ul{list-style-type:none;height:112pt}.pdf-body .content ul li{font-size:12pt;display:block;float:left;height:22.5pt;line-height:17pt;list-style:none;margin-right:20pt;width:100%}.pdf-body .content ul li div{display:block;float:left;border:1pt solid;width:15pt;height:15pt;margin-right:10pt}.pdf-body .content ul.horizontal{list-style-type:none;height:30pt}.pdf-body .content ul.horizontal li{display:block;float:left;list-style:none;margin-right:20pt;width:auto}.pdf-body .content ul.horizontal li div{display:block;float:left;border:1pt solid;margin-right:10pt}.pdf-body .content ul.horizontal-fixed{list-style-type:none;height:30pt}.pdf-body .content ul.horizontal-fixed li{display:block;float:left;list-style:none;margin-right:20pt;width:250pt}.pdf-body .content ul.horizontal-fixed li div{display:block;float:left;border:1pt solid;margin-right:10pt}    

Hearing Tracker Survey

Code: a9e78

Thank you for taking the time to review your hearing aid(s) and hearing provider. Your responses will be made available to your hearing provider and to the public (anonymously). It is important that you answer these questions as honestly as possible. Your answers will help your provider to improve their practice and help provide valuable feedback to hearing aid manufacturers. For more information please visit hearingtracker.com

Please complete the included surveys and return to:

Hearing Tracker, Inc
PO Box 40702
Austin, TX 78704

Hearing Aid Outcome Survey

Place a check mark in one box per question.

1) How much does your hearing aid help you to hear speech in quiet environments?

  • Vast improvement with the hearing aid(s)
  • Good improvement with the hearing aid(s)
  • Slight improvement with the hearing aid(s)
  • No improvement with the hearing aid(s)
  • I heard better without the hearing aid(s)

2) How much does your hearing aid help you to hear speech in noisy situations (restaurants, crowds, etc)?

  • Vast improvement with the hearing aid(s)
  • Good improvement with the hearing aid(s)
  • Slight improvement with the hearing aid(s)
  • No improvement with the hearing aid(s)
  • I heard better without the hearing aid(s)

3) How much does your hearing aid help you to hear speech on the phone?

  • Vast improvement with the hearing aid(s)
  • Good improvement with the hearing aid(s)
  • Slight improvement with the hearing aid(s)
  • No improvement with the hearing aid(s)
  • I heard better without the hearing aid(s)

4) How clear and natural does the hearing aid sound?

  • Very clear and natural
  • Somewhat clear and natural
  • Clear or natural, but not both
  • Neither clear nor natural
  • The sound is unbearable

5) How much does your hearing aid improve your hearing for music?

  • Vast improvement with the hearing aid(s)
  • Good improvement with the hearing aid(s)
  • Slight improvement with the hearing aid(s)
  • No improvement with the hearing aid(s)
  • I heard better without the hearing aid(s)

6) How comfortable is the hearing aid?

  • I don't even notice the hearing aid in my ear
  • I can feel the hearing aid in my ear, but it's very comfortable
  • The hearing aid is slightly uncomfortable after a few hours
  • The hearing aid is not comfortable, but I can tolerate it
  • The hearing aid hurts my ear

7) How reliable is the hearing aid?

  • I've had no problems, and expect none in the future
  • I've had no problems, but anticipate there might be some in the future
  • I've had some issues, but nothing I couldn't take care of myself
  • I've had some issues with my hearing aid, but my provider has taken care of it in the clinic
  • My hearing aid has been sent offsite for repair by my audiologist

8) Does the hearing aid do a good job of stopping unwanted feedback (buzzing and whistling)?

  • I never hear feedback from my hearing aid
  • My hearing aid creates feedback very rarely
  • My hearing aid creates feedback occasionally
  • My hearing aid creates feedback often
  • My hearing aid creates feedback frequently

9) How much does the hearing aid improve your hearing?

  • Vast improvement with the hearing aid(s)
  • Good improvement with the hearing aid(s)
  • Slight improvement with the hearing aid(s)
  • No improvement with the hearing aid(s)
  • The hearing aid hurts my ear

10) How would you rate the value of your hearing aid?

  • Excellent value
  • Great value
  • Good value
  • Fair value
  • Poor value

What would you tell others about your experience with your hearing aid(s)? Please DO NOT review your provider here.

More to say? Please continue on the back of this page, or on a separate sheet of paper.

Provider Survey

The location was easy to access, pleasant, and professional

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

I was seen in a reasonable amount of time

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

My provider listened to me

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

My provider was knowledgable

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

My provider adequately explained procedures and results

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

My provider solved or offered solutions for my hearing needs

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

I am satisfied with the overall experience

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

I would recommend my provider to a family member or friend

  • Strongly Agree
  • Agree
  • Neutral
  • Disagree
  • Strongly Disagree

Please provide a short review of your hearing professional.

More to say? Please continue on the back of this page, or on a separate sheet of paper.

wkhtmltopdf可以(并且将)使用系统字体通过其无头wekbkit浏览器呈现内容。

所以你的问题实际上是开发和生产中不同环境的问题。

如果您可以控制服务器,可以尝试安装freetypefontconfig软件包以在服务器上获取额外的字体,或者将样式表中的字体作为OTF文件提供,如下所示:

 # in application.css.erb @font-face { font-family: 'OpenSansRegular'; src: url('<%= font_url('OpenSans.otf') %>'); font-weight: normal; font-style: normal; } 

并告诉样式表使用它:

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

如果你没有OTF中的字体, 这里有一个转换它们的服务 。