0

I use laravel dompdf to create PDF files. What I'm trying to do is create pdf file, upload it to storage and then download it. there's specific endpoint, when user call it all these actions happen.

    // fetch data for pdf
    $pdfData = $this->getData();

    // creates pdf from html
    $pdf = PDF::loadView('pdf.example', [
        'items' => $pdfData
    ])->setPaper('a4', 'landscape');

    // upload file to storage
    Storage::put("/my-path", $pdf->output());

    // download file
    return $pdf->download("file.pdf");

In html(from which pdf's been created) I have custom fonts(load them with @font-face). the issue is that after calling output method $pdf->output() the characters in pdf are invalid enter image description here

BUT, if I don't call $pdf->output() characters are shown properly(with my custom fonts). so the issue happens only when I use custom fonts and then call $pdf->output(). any idea how to fix it?

I already saw this solution but it doesn't help, also there's no load_font.php in this package

devnull Ψ
  • 3,779
  • 7
  • 26
  • 43
  • Possible duplicate of [Custom Fonts for DOMPDF](https://stackoverflow.com/questions/12581156/custom-fonts-for-dompdf) – rchatburn Oct 24 '18 at 11:59
  • @rchatburn my question is not about how to load custom fonts, I already did it. also there's no `load_font.php` file in this package, that answer probably too old – devnull Ψ Oct 24 '18 at 13:45

0 Answers0