Using Laravel Framework 10.48.3
I’m using the following in my scripts tag:
<script type="text/php">
if (isset($pdf)) {
$text = "page {PAGE_NUM} / {PAGE_COUNT}";
$size = 10;
$font = $fontMetrics->getFont("Verdana");
$width = $fontMetrics->get_text_width($text, $font, $size) / 2;
$x = ($pdf->get_width() - $width) / 2;
$y = $pdf->get_height() - 35;
$pdf->page_text($x, $y, $text, $font, $size);
}
</script>
Usage in Controller:
public function getOutput(): string
{
$pdf = PDF::loadView($this->getOutputBladeTemplate(), $this->getOutputData());
return $pdf->output();
}
Below is a screenshot of Page 1, there are 2 pages in this document and the total count appears to have a 1 and 2 overlap
On the second page however it appears correctly:
In styling I’m currently using:
<style>
header {
position: fixed;
}
</style>
If I remove the fixed position then despite having 2 pages only the first page will show:
image
and then the second will show no page numbering.