gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'上面的两个gem是used.but,当分页时,我会得到文本切分的问题。如截图所示

我使用了下面这段代码:
<%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;任何帮助都将不胜感激。
发布于 2018-04-27 13:14:03
您的文本似乎位于脚注之下,因此在调用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的分页符属性。
另外,如果你不能使用:page-break-inside: avoid !important;,那么你可以试试page-break-before: always;
https://stackoverflow.com/questions/50055533
复制相似问题