Support the ongoing development of Laravel.io →
Views Packages
Last updated 2 years ago.
0

I checked and there is no fonts directory in the storage folder.

If there aren't, you might want to create it ? Read the error one more time.

Last updated 2 years ago.
0

Thanks ChrisRM, Hmm just seems odd that it was creating PDFs for me, but then stopped without me changing anything.

But I did go ahead and just create that storage/fonts folder. Now it gives another error.

ErrorException

DOMXPath::query(): Invalid expression

…/­vendor/­dompdf/­dompdf/­include/­stylesheet.cls.php853

}
// Apply all styles in stylesheet
foreach ($this->_styles as $selector => $style) {
$query = $this->_css_selector_to_xpath($selector);
// Retrieve the nodes
$nodes = @$xp->query($query["query"]);
if ( $nodes == null ) {
record_warnings(E_USER_WARNING, "The CSS selector '$selector' is not valid", __FILE__, __LINE__);
Last updated 2 years ago.
0

There seem to be something wrong with the _css_selector_to_xpath() method. To debug this, check out the latest code for stylesheet.cls.php. Print out the $query variable to see what it looks like.

}
// Apply all styles in stylesheet
foreach ($this->_styles as $selector => $style) {
$query = $this->_css_selector_to_xpath($selector);
var_dump($query);
// Retrieve the nodes
$nodes = @$xp->query($query["query"]);
if ( $nodes == null ) {
record_warnings(E_USER_WARNING, "The CSS selector '$selector' is not valid", __FILE__, __LINE__);
Last updated 2 years ago.
0

Thanks for the suggestion. I have been trying to make some sense of it here this afternoon, but I'm getting no where.

Here is the value of the $query variable:

array (size=2) 'query' => string '//descendant::html' (length=18) 'pseudo_elements' => array (size=0) empty

Last updated 2 years ago.
0

Are you sure the HTML/CSS is correct? Dompdf isn't really good with complex layouts. An alternative is https://github.com/barryvdh/laravel-snappy

Last updated 2 years ago.
0

One of the things I have found with the Dompdf package is that when you do a composer update it wipes out the fonts folder in the vendor directory. So if you had a custom font every time it updates you get a problem with fonts.

Last updated 2 years ago.
0

Yes never save anything in the vendor dir. But shouldn't the latest version store the fonts in storage/fonts?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

marcelg7 marcelg7 Joined 27 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.