Da dompdf FAQ
D: Come posso aggiungere un'immagine a un'intestazione o piè di pagina su ogni pagina? A: è possibile aggiungere immagini e forme (linee, rettangoli, ecc.) Ad ogni pagina utilizzando "oggetti" PDF. Un oggetto PDF cattura tutti i comandi di rendering come una sorta di modello che può poi essere aggiunto a più pagine:
<script type="text/php">
if (isset($pdf)) {
// Open the object: all drawing commands will
// go to the object instead of the current page
$footer = $pdf->open_object();
$w = $pdf->get_width();
$h = $pdf->get_height();
// Draw a line along the bottom
$y = $h - 2 * $text_height - 24;
$pdf->line(16, $y, $w - 16, $y, $color, 1);
// Add an initals box
$font = Font_Metrics::get_font("helvetica", "bold");
$text = "Initials:";
$width = Font_Metrics::get_text_width($text, $font, $size);
$pdf->text($w - 16 - $width - 38, $y, $text, $font, $size, $color);
$pdf->rectangle($w - 16 - 36, $y - 2, 36, $text_height + 4, array(0.5,0.5,0.5), 0.5);
// Add a logo
$img_w = 2 * 72; // 2 inches, in points
$img_h = 1 * 72; // 1 inch, in points -- change these as required
$pdf->image("print_logo.png", "png", ($w - $img_w)/2.0, $y - $img_h, $img_w, $img_h);
// Close the object (stop capture)
$pdf->close_object();
// Add the object to every page. You can
// also specify "odd" or "even"
$pdf->add_object($footer, "all");
}
</script>
EDIT:
Qui ci sono le istruzioni passo passo:
Da qualche parte nel file html, nella parte superiore, apri un tag script con un tipo "text/php":
<script type="text/php">
Verificare se la variabile $ pdf è impostata. dompdf imposta questa variabile quando valuta PHP incorporato.
<script type="text/php">
if (isset($pdf)) {
possibile duplicato di [Header nella pagina PDF utilizzando dompdf in PHP] (http://stackoverflow.com/questions/7484318/header-in-pdf-page-using-dompdf-in-php) Non – Foobar
certo perché stai inviando un sacco di non-risposte a questa domanda sei mesi dopo. Ma per favore non farlo. – BoltClock