Rails: WickedPDF: Page Breaks

前端 未结 6 2048
灰色年华
灰色年华 2020-12-13 12:55

In my Ruby (1.9.2) Rails (3.0.x) I would like to render a web page as PDF using wicked_pdf, and I would like to control where the page breaks are. My CSS code to control pag

6条回答
  •  攒了一身酷
    2020-12-13 13:25

    None of these solutions worked for me. I did find a solution that worked for many people in the gem issues here - https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1524

    you want to add CSS on the element that needs the page break. In my case, it was table rows, so I added:

    tr {
     page-break-inside: avoid;
    }
    

提交回复
热议问题