Open nemanja-ivanis opened 5 months ago
This is just a Dompdf wrapper! I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters/images/html etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.
I got this error too.
and here is my code.
` $domPdf = $pdf->getDomPDF(); $canvas = $domPdf->get_canvas(); $font = $domPdf->getFontMetrics()->get_font("thsarabun", "normal"); // get null because there are not cached in storage/fonts
// comment here to cache fonts file $canvas->page_text( $x = $canvas->get_width() - 80, $y = $canvas->get_height() - 40, $text = "Page Number {PAGE_NUM} of {PAGE_COUNT}", $font = $font, $size = 15, $color = array(0, 0, 0) );
return $pdf->stream('example.pdf');
`
I have already put my fonts file .ttf to storage/fonts but Laravel doesn't cache it into .ufm file.
so I comment line $canvas->page_text()
and run only return $pdf-stream()
. It start to generate cache fonts file inside storage/fonts
So I uncomment $canvas->page_text()
and It work. It ref pic is my final files inside storage/fonts
( sorry for my English.)
When i try to output my pdf i get "Undefined array key ''" on line 4752 in dompdf\dompdf\lib\Cpdf.php. That particular line of code is:
$font = $this->fonts[$this->currentFont];
Both $this->fonts and $this->currentFont are empty. Why is this happening and how can i fix it? Why are those arrays and variables empty? It seems like a problem with the package.
I am using laravel 10.10 and barryvdh/laravel-dompdf 2.0.1.