Questo è un compito abbastanza difficile e non penso che sia possibile risolvere questo problema con CSS puro in questo momento (anche se mi piacerebbe essere smentito).
Anche il supporto per determinate interruzioni di pagina (page-break-inside: avoid;
) non è il migliore. In effetti non credo che funzioni finora con il tavolo. Probabilmente ti ritroverai con alcune file divise attorno al pagebrake. (Webkit rende un PDF e poi lo taglia in pagine singole, per lo più a prescindere che cosa è sul bordo ...)
La mia soluzione a questo dilemma è stato quello di creare un'unica segnaposto div
s nella dimensione di un singolo pagina e quindi distribuire il contenuto con qualche langugae di programmazione tra questi segnaposto prima di generare il PDF.
Nell'ultimo di tali wrapper è quindi possibile aggiungere un footer posizionato in modo assoluto nella parte inferiore.
Ecco alcuni esempi di codice:
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Sample Data</title>
<style>
* {
padding: 0;
margin: 0;
}
.page {
page-break-inside: avoid;
height: 1360px;
position: relative;
}
table {
border-collapse: collapse;
width: 100%;
}
td {
border: 1px solid #ccc;
padding: .23em;
}
.footer {
position: absolute;
color: red;
bottom: 0;
}
</style>
</head>
<body>
<div class="page one">
<p>
Some info Here... at the top of first page
</p>
<!-- Zen Coding: table>tbody>(tr>td>{A sample table}+td>{Foo bar})*42 -->
<table>
<tbody>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
</tbody>
</table>
</div>
<div class="page two">
<table>
<tbody>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
<tr><td>A sample table</td><td>Foo bar</td></tr>
</tbody>
</table>
<p class="footer">
The last info here in the bottom of last page
</p>
</div>
</body>
</html>
Grazie, ho avuto un sacco di problemi perché non avevo la versione con patch QT, ho trascorso molto tempo a compilare senza successo finché non ho realizzato che c'era una versione binaria nella pagina. – juanefren