- Issue created by @dionhalcyon
- First commit to issue fork.
- @ranjit1032002 opened merge request.
- Status changed to Needs review
over 1 year ago 12:45pm 20 April 2023 - 🇮🇳India Ranjit1032002
Created MR!3 for the issue mentioned, please review.
Thank you. - Status changed to Postponed: needs info
over 1 year ago 12:53pm 20 April 2023 Hello,
I just have this error with an 10.0.8 Drupal and with a 9.5.9 Drupal
My server have this configuration : Apache/2.4.54 (Unix) OpenSSL/1.1.1k PHP/8.1.6My views are basic, I left the default configuration, my path is in the form /convention-impression.
The first time I generate the PDF view it works, but not after that.What do others want as pieces of information ?
- 🇹🇼Taiwan cbroker
I have the same issue and found that if I clear the cache, I can run it again.
- 🇨🇦Canada leducdubleuet Chicoutimi QC
I had the same issue, the views_pdf was exporting to PDF only the first time and clearing the cache made it work again but only once.
I tried the patch in MR!3 but it was creating an error on the return $response...
So I disabled the cache on the PDF view and now it is working well everytime!
I had the "Tag based" and using "No caching" made it work.
- 🇪🇸Spain abelass
Same for me emptying the cache or removing caching from the view removes the error
- Status changed to Needs work
8 months ago 12:01pm 23 April 2024 - 🇨🇦Canada leducdubleuet Chicoutimi QC
So to replicate this error, you leave the cache on and the view pdf will work only once the first time.
Disabling the cache completely on the view solves this issue for good.
Thank you for looking into this.
- 🇬🇧United Kingdom stevewilson
I too am seeing this, but I'm also seeing 🐛 Return value must be of type Symfony\Component\HttpFoundation\StreamedResponse Active on the first (successful) generation of the PDF. The error message in 3426719 references Drupal\Core\Cache\CacheableResponse, so I was wondering whether that issue might be corrupting the cache in some way and explain why clearing the caches following the first PDF generation allows the PDF to be generated successfully a seconf time? Will fixing 3426719 fix this (3355295) issue too?
Further information:
When the second attempt to generate the PDF fails, I also see 3 warnings:Warning: Undefined array key "view_build" in Drupal\views_pdf\Plugin\views\display\PDF::buildResponse() (line 139 of /home/techsoco/d10-dev-2.techsoc.org.uk/public_html/modules/contrib/views_pdf/src/Plugin/views/display/PDF.php)
Warning: Trying to access array offset on value of type null in Drupal\views_pdf\Plugin\views\display\PDF::buildResponse() (line 139 of /home/techsoco/d10-dev-2.techsoc.org.uk/public_html/modules/contrib/views_pdf/src/Plugin/views/display/PDF.php)
Warning: Attempt to read property "pdf" on null in Drupal\views_pdf\Plugin\views\display\PDF::buildResponse() (line 141 of /home/techsoco/d10-dev-2.techsoc.org.uk/public_html/modules/contrib/views_pdf/src/Plugin/views/display/PDF.php)
As with other respondents, I find that the inability to load a PDF a second time is elliminated by disabling caching on the PDF View, but it would be nice to have a "proper" fix. Note also, that with caching disabled, issue 3426719 is still present.
I will add a comment to 3426719 as well, questioning whether there is a link to this issue.
- 🇬🇧United Kingdom stevewilson
I suggested previously that "it would be nice to have a "proper" fix" for this issue; however, a test on a Drupal 7 site I have suggests that Views PDF may never have worked with caching turned on.
The PDF display in my Drupal 7 view has caching turned off by default and has been working happliy for years. I tried turning caching on, and found that only once would the PDF page load successfully - the second attempt does load an A4 page, but it's blank. There is no error message to indicate why this might be.
Tested with Drupal core 7.103, Views PDF 7.x-3.1, PHP 8.1
Should we accept that Views PDF (3.x-dev) requires PDF displays to have caching turned off? Or is there a bug that should really be fixed? What does the maintainer have to say on this?
If we are to accept that caching needs to be turned off, then the documentation needs to state this.