SOFTELメモ Developer's blog

会社概要 ブログ 調査依頼 採用情報 ...
てるてる動画

wkhtmltopdfでtheadが重なるのを回避する

問題

wkhtmltopdfでPDFの帳票を生成しているのですが、tableでtheadを使うと、2ページ目以降でtheadがtbodyの内容と重なってしまいます。回避できますか?

wkhtmltopdf-thead-problem

答え

以下のスタイルシートを追加して回避できる こともあるようです。

tr { page-break-inside: avoid; }

wkhtmltopdf-thead-problem resolve

それでもレイアウトが崩れる場合は、以下で改善する場合もあります。

table, tr, td, th, tbody, thead, tfoot {
    page-break-inside: avoid !important;
}

関連するメモ

コメント