ruby-on-rails - Wicked_pdf 目录文本大小非常小
问题描述
我正在尝试使用生成 PDF
WIckedPdf 版本 = 1.1.0
wkhtmltopdf 0.12.4(带有补丁的qt)
导轨 4.2
下面是我的控制器端点
@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'
我面临的问题是 pdf 中生成的所有文本都非常小。为了在 pdf 中实现 14 的字体大小,我不得不将我的 css 更改为 font-size: 56px (是正常像素的四倍)
任何人都可以帮我为什么字体大小是这样呈现的吗?此外,包括填充、边距等像素的所有 css 都比正常小四倍。
即使将我的文件的 CSS 更改为高四倍的值,目前我也无法更改生成的目录的 FONT_SIZE。
任何帮助/参考都会非常有帮助和赞赏
解决方案
设置dpi: 300
应该可以解决内容渲染过小的问题。
推荐阅读
- python-3.x - 在 Python 中的函数中加入 while 循环
- javascript - 有没有办法在应用程序中切换前后摄像头
- sapui5 - 如何将整数输入值绑定到滑块
- javascript - 如何将 Formik Field 组件抽象为通用可共享组件
- python-3.x - 如何在 Scikit-Learn 中获取 GridSearchCV() 的 OneVsRestClassifier(LinearSVC()) 的估计器键引用?
- reactjs - 失败的道具类型:ForwardRef(Button):道具类型`component`无效:React中带有材料ui的警告
- c# - 在 Windows 窗体属性中调整大小不起作用
- android - 我是否必须为打捞的 android 地图应用程序重新生成新的 SHA-1 密钥?
- php - 无法在构造函数中获取会话
- python-3.x - 您如何限制多个数字的输出中的小数位数?