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.
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__);
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__);
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
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
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.
Yes never save anything in the vendor dir. But shouldn't the latest version store the fonts in storage/fonts?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community