#javascript #html #css #wkhtmltopdf
Вопрос:
Я пытаюсь сгенерировать pdf-файл, содержащий таблицу, и я получаю разрыв страницы внутри строки, вот чего я не хочу.
Вот мой html-код и css-код, я пробовал избегать взлома страниц и т. Д., Но все еще не нашел решения. Я обсуждаю, является ли это ошибкой wkhtmltopdf или чем-то в моем css-коде
thead {
display: table-row-group;
}
tr.test {
page-break-before: avoid;
page-break-after: avoid;
page-break-inside: avoid;
}
table {
word-wrap: break-word;
}
table td {
word-break: break-all;
}
table,tr, td{
border: 1px solid black;
}
<body>
<table>
<tr>
<td rowspan=2>1</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>2</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>3</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>4</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>5</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>1</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>2</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>3</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>4</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>5</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>1</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>2</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>3</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=4>4</td><td>1</td>
</tr>
<tr class="test">
<td>2</td>
</tr>
<tr class="test">
<td>2</td>
</tr>
<tr class="test">
<td>2</td>
</tr>
<tr>
<td rowspan=2>5</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>1</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>2</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>3</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>4</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>5</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>1</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>2</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>3</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>4</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>5</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>1</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>2</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>3</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>4</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
<tr>
<td rowspan=2>5</td><td>1</td>
</tr>
<tr>
<td>2</td>
</tr>
</table>
</body>
Комментарии:
1. я бы попытался
page-break-before: always;
, а ты ?2. Да, уже пробовал