I'm using gem wiked_pdf in my Rails application that generates report.
But I'm having trouble fixing the breaking of data when having more that 1 page.
I tried many time to adjust the margin or spacing, but still unable to fix it.
respond_to do |format|
format.html
format.pdf do
render title: @report_title,
pdf: @report_title,
template: 'applicants/generate_report.pdf.erb',
encoding: 'UTF-8',
orientation: 'Landscape',
layout: 'pdf_template.html',
footer: {
center: '[page] of [topage]',
right: "",
font_name: 'Arial',
font_size: 8
},
margin: {
top: 10, # default 10 (mm)
bottom: 12,
left: 7,
right: 7
},
spacing: 0
end
end
I also tried to apply CSS, like:
@media print {
td, tr {page-break-inside: avoid; }
table.full_report_table>tbody>tr>td {page-break-inside: avoid !important; }
}
Nothing works!
Please help!
display: inline-block;
in addition topage-break-inside: avoid;
is what finally got this working for me. I think the combination of these two needs to be emphasized more. Thanks for doing so! – Fabio