[英]Text cut with wkhtmltopdf-binary
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
以上使用了兩個gems。但是當頁面中斷時我遇到了文本剪切的問題。 就像截圖一樣
我正在使用這段代碼:-
<%if current_company&.po_term.present?%>
<div class="row po_term_condtions" style="page-break-before: always;">
<div class="col-lg-12 col-md-12 col-sm-12" style="page-break-inside:avoid !important;">
<strong> PO Terms: </strong>
<%=current_company&.po_term&.po_description.html_safe%>
</div>
</div>
<%end%>
但是我已經嘗試了一些先前問過的建議,但似乎不起作用
page-break-inside:avoid !important;
page-break-inside:avoid; display: inline; // display: block;
任何幫助,將不勝感激。
您的文本似乎位於頁腳下方,因此請首先確保在致電WickedPDF時為頁腳設置邊距:
pdf = WickedPdf.new.pdf_from_string(
html,
margin: { top: 30, bottom: 30, left: 30, right: 30 },
header: { content: html_header, spacing: 10 },
footer: { content: html_footer, spacing: 10 }
)
您可能需要進行試驗,我注意到wkhtmltopdf
可能會因版本而異,並且我記得有些版本忽略了CSS分頁wkhtmltopdf
屬性。
另外,如果不能使用它: page-break-inside: avoid !important;
那么您可以嘗試使用page-break-before: always;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.