I am trying to generate PDF using
我正在尝试使用生成PDF
WIckedPdf version = 1.1.0
WIckedPdf版本= 1.1.0
wkhtmltopdf 0.12.4 (with patched qt)
wkhtmltopdf 0.12.4(补丁qt)
Rails 4.2
Below is my Controller endpoint
以下是我的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'
Am facing the problem that All the text that are generated in pdf is very very SMALL. To achieve font size of 14 in pdf, i had to change my css as font-size: 56px (Four times than the normal pixel)
面临的问题是,pdf中生成的所有文本都非常小。要在pdf中实现14的字体大小,我不得不将我的css更改为font-size:56px(比普通像素高四倍)
Can Anybody help me why font size is rendered like this? Also, All the css that includes pixels such as padding, margin are four times smaller than normal.
任何人都可以帮我解释为什么字体大小会像这样呈现?此外,所有包含填充,边距等像素的css都比正常情况小四倍。
Even if changed CSS of my file to four times higher values, CURRENTLY I AM UNABLE TO CHANGE FONT_SIZE FOR TABLE OF CONTENTS GENERATED.
即使将我的文件的CSS更改为高四倍的值,当前我也无法更改FONT_SIZE表示生成的内容。
Any help / Reference would be highly helpful and appreciated
任何帮助/参考将非常有帮助和赞赏
2 个解决方案
#1
0
I had the same issue and, I could fix it by adding lowquality: true
to wicked_pdf config file.
In config/wicked_pdf.rb
file
我有同样的问题,我可以通过添加lowquality修复它:true到wicked_pdf配置文件。在config / wicked_pdf.rb文件中
WickedPdf.config = {
#cross enviroment configs
}
if Rails.env.development?
WickedPdf.config[:lowquality] = true
end
Credits & Reference: Issue #754
致谢与借鉴:问题#754
#2
-1
You can add CSS class in your view template to increase the Font Size like normal HTML.
您可以在视图模板中添加CSS类,以像普通HTML一样增加字体大小。
#1
0
I had the same issue and, I could fix it by adding lowquality: true
to wicked_pdf config file.
In config/wicked_pdf.rb
file
我有同样的问题,我可以通过添加lowquality修复它:true到wicked_pdf配置文件。在config / wicked_pdf.rb文件中
WickedPdf.config = {
#cross enviroment configs
}
if Rails.env.development?
WickedPdf.config[:lowquality] = true
end
Credits & Reference: Issue #754
致谢与借鉴:问题#754
#2
-1
You can add CSS class in your view template to increase the Font Size like normal HTML.
您可以在视图模板中添加CSS类,以像普通HTML一样增加字体大小。