trobfab / fabrik

Fabrik for Joomla 4.x
http://fabrikar.com
Other
25 stars 4 forks source link

PDF no longer works in J!4.2.2 #273

Closed joomlahenk closed 2 years ago

joomlahenk commented 2 years ago

Used to work in J!4.1.5. I get unable to load document.

joomlahenk commented 2 years ago

Used to work in J!4.1.5 Tried again in J!4.1.5 and even J!4.0.4 (PHP8.0), but doesn't work there also. I don't know what has happend, because I am sure we tested this ok. I only get a Warning: Array to string conversion in /var/www/html/praktijk_copy/libraries/fabrik/fabrik/Document/Renderer/Pdf/HeadRenderer.php on line 364 The raw page looks ok to me, but I get unable to load document. Could it be an issue with dompdf (version 1.0.2) or dompdf no loaded??

skurvish commented 2 years ago

I just tried it in J4.2.3 and it seems to work. Printed a form using the pdf icon and the pdf was produced just fine. Can you update to 4.2.3 and see if it is still an error for you?

joomlahenk commented 2 years ago

Still have this issue on J!4.2.3. I think it may not be a fabrik issue since it's working for you. If I select PDF from the list view, it will always download the PDF even if I set it to view in the browser (chrome). If I open the PDF file I get 'unable to load document'. Any other, not fabrik generated, PDF has no issue

joomlahenk commented 2 years ago

I did a new upgrade & install the latest fabrik4 version (03-10-2022) from github (J!4.2.3 PHP8.1). When I try to open a PDF now I get: Unable to find a suitable font replacement for: 'serif'

skurvish commented 2 years ago

Try now with PR #287

joomlahenk commented 2 years ago

Updated with PR #287, no more font error but PDF still not solved. Still get 'unable to load document'. Also tried with mpdf, but that throws a fatal error. I am sure I tested this a while ago and (DOM)PDF was working.

skurvish commented 2 years ago

Just tried it on my system with a simple form and it printed OK. When I try the PDF icom from the list view I get Failed to load document.

skurvish commented 2 years ago

I assume this is the error you are seeing? Turn off all debug in Joomla. Then it should work, worked for me on the list view.

joomlahenk commented 2 years ago

Yes, that's the error I have. I turned off all debug, but still have the error.

skurvish commented 2 years ago

OK, can you make an akeeba back of the site with the issue so I can test it?

joomlahenk commented 2 years ago

OK, I did a complete new install with latest github and now PDF is working. It does not to work if I just copy new files, a fabrik re-install seems to be required. Only question left is why PDF is not opened in the browser but is downloaded instead (yes, I set the browser the view the PDF in the browser). MPDF does not work yet. See new issue.

skurvish commented 2 years ago

Has to do with the content-disposition of the file headers. No idea where that is set but will have a look.

skurvish commented 2 years ago

The default action of dompdf is to send all pdf's as attachments. This is set via the Content-Disposition header. if the header is set to inline then the browser will open it. At present fabrik does not set this value so it defaults to attachment. If you feel it is important to allow for inline then an option will have to be added to the various places pdfs are created.

I think this is more work than we want and a change in behaviour over F3.

Closing this issue as resolved.