Wicked_pdf目录的文字大小非常小

Dha*_*esh 3 pdf-generation ruby-on-rails wkhtmltopdf wicked-pdf ruby-on-rails-4.2

我正在尝试使用生成PDF

WIckedPdf版本= 1.1.0

wkhtmltopdf 0.12.4(带有修补的qt)

Rails 4.2

以下是我的Controller端点

@cover = render_to_string layout: "application.html.erb", template: "pdf/cover.html.erb", locals: {report: @report}
@pdf = render_to_string pdf: "report",
encoding: "UTF-8",
page_size: 'A4',
layout: "pdf.html.erb",
orientation: 'Portrait',
disable_smart_shrinking: false,
disable_internal_links: false,
disable_external_links: false,
lowquality: false,
background: true,
no_background: false,
page_height: 297,
page_width: 210,
cover: @cover,
template: "pdf/report.pdf.erb",
locals: {report: @report},
show_as_html: false,
margin: {
bottom: 40,
top: 10
},
footer: {
html: {
template: 'pdf/footer.html.erb' # use :template OR :url
}
},
toc: {
text_size_shrink: 0.8,
header_text: "Table of Contents",
no_dots: false,
disable_dotted_lines: false,
disable_links: false,
disable_toc_links: false,
disable_back_links: false,
}

send_data @pdf, type: :pdf, disposition: 'inline'
Run Code Online (Sandbox Code Playgroud)

面临着pdf生成的所有文本非常小的问题。要在pdf中实现14的字体大小,我必须将css更改为font-size:56px(比正常像素大四倍)

谁能帮我为什么这样显示字体大小?此外,所有包含像素(例如填充,边距)的css都比正常情况下小四倍。

即使将文件的CSS更改为更高的四倍,当前我也无法更改生成的目录的FONT_SIZE。

任何帮助/参考将非常有帮助和赞赏

Chr*_*ill 7

设置dpi: 300应该解决您的问题,即内容渲染太小。