Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined array key "" #3384

Open
nemanja-ivanis opened this issue Feb 2, 2024 · 5 comments
Open

Undefined array key "" #3384

nemanja-ivanis opened this issue Feb 2, 2024 · 5 comments

Comments

@nemanja-ivanis
Copy link

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?

@bsweeney
Copy link
Member

bsweeney commented Feb 2, 2024

Those should never be empty, what does your code look like on the PHP side of things?

@nemanja-ivanis
Copy link
Author

nemanja-ivanis commented Feb 2, 2024

$pdf = \PDF::loadView('layouts.pdf', compact('otherContact', 'currentDate', 'companyData', 'clinic', 'employee', 'startDate', 'endDate', 'qualification'))->setPaper('a4', 'portrait');
Storage::disk('local')->put('clinics/' . $clinic->id . '/contracts/' . $pdfName, $pdf->output());

I have no idea why are those empty...

A note - i am using https://github.com/barryvdh/laravel-dompdf but the error comes from dompdf/dompdf library.

@bsweeney
Copy link
Member

bsweeney commented Feb 2, 2024

I'm not a laravel user, so you might ask on that project. Perhaps you need to update the fontDir configuration?

@nemanja-ivanis
Copy link
Author

I tried, but with no luck.

@bsweeney
Copy link
Member

bsweeney commented Feb 4, 2024

What is layouts.pdf? Is that a PDF document or a Laravel blade template that just happens to have .pdf in its name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants