Problem with generating PDFs in Joomla 5

Trembowiecki

Active Member
Hi, I just wanted to ask if you can replicate this problem: I try to generate PDF in Fabrik form and all I get is this error:

There is no "template.cassiopeia.ltr" asset of a "preset" type in the registry.

When I enable debugging I get this:

# Function Location
1 () JROOT/libraries/src/WebAsset/WebAssetRegistry.php:135
2 Joomla\CMS\WebAsset\WebAssetRegistry->get() JROOT/libraries/src/WebAsset/WebAssetManager.php:263
3 Joomla\CMS\WebAsset\WebAssetManager->useAsset() JROOT/libraries/src/WebAsset/WebAssetManager.php:197
4 Joomla\CMS\WebAsset\WebAssetManager->__call() JROOT/templates/cassiopeia/component.php:50
5 require() JROOT/libraries/src/Document/HtmlDocument.php:731
6 Joomla\CMS\Document\HtmlDocument->_loadTemplate() JROOT/libraries/src/Document/HtmlDocument.php:785
7 Joomla\CMS\Document\HtmlDocument->_fetchTemplate() JROOT/libraries/src/Document/HtmlDocument.php:622
8 Joomla\CMS\Document\HtmlDocument->parse() JROOT/libraries/src/Application/CMSApplication.php:1057
9 Joomla\CMS\Application\CMSApplication->render() JROOT/libraries/src/Application/SiteApplication.php:732
10 Joomla\CMS\Application\SiteApplication->render() JROOT/libraries/src/Application/CMSApplication.php:311
11 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58
12 require_once() JROOT/index.php:32

PHP 8.2.13, Joomla 5.0.1, Fabrik 4.0 Zeta, fresh installation, template: Cassiopeia.

UPDATE: The same happens in my Joomla 4 installation. Changing PHP to 8.1.x doesn't fix the problem either. This is getting serious.

UPDATE 2: The details view works like it should. It's just this '?format=pdf' suffix makes go everything South.
 
Last edited:
Alright, some more info: the above situation happened when I used child template.

Regarding Joomla4: when I switched to parent template, PDFs suddenly started to work.

Regarding Joomla5: when I switched to parent template, PDFs still don't work, but the error looks totally different:

Argument 'document' of event onBeforeCompileHead is required but has not been provided

# Function Location
1 () JROOT/libraries/src/Event/Application/ApplicationDocumentEvent.php:38
2 Joomla\CMS\Event\Application\ApplicationDocumentEvent->__construct() JROOT/libraries/src/Application/EventAware.php:106
3 Joomla\CMS\Application\WebApplication->triggerEvent() JROOT/libraries/fabrik/fabrik/fabrik/Document/Renderer/Pdf/HeadRenderer.php:72
4 Fabrik\Document\Renderer\Pdf\HeadRenderer->fetchHead() JROOT/libraries/fabrik/fabrik/fabrik/Document/Renderer/Pdf/HeadRenderer.php:43
5 Fabrik\Document\Renderer\Pdf\HeadRenderer->render() JROOT/libraries/src/Document/HtmlDocument.php:575
6 Joomla\CMS\Document\HtmlDocument->getBuffer() JROOT/libraries/fabrik/fabrik/fabrik/Document/PdfDocument.php:340
7 Fabrik\Document\PdfDocument->getBuffer() JROOT/libraries/src/Document/HtmlDocument.php:894
8 Joomla\CMS\Document\HtmlDocument->_renderTemplate() JROOT/libraries/src/Document/HtmlDocument.php:647
9 Joomla\CMS\Document\HtmlDocument->render() JROOT/libraries/fabrik/fabrik/fabrik/Document/PdfDocument.php:267
10 Fabrik\Document\PdfDocument->render() JROOT/libraries/src/Application/CMSApplication.php:1073
11 Joomla\CMS\Application\CMSApplication->render() JROOT/libraries/src/Application/SiteApplication.php:732
12 Joomla\CMS\Application\SiteApplication->render() JROOT/libraries/src/Application/CMSApplication.php:311
13 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58
14 require_once() JROOT/index.php:32
 
Last edited:
Issues with child templates had been reported already for F4/J!4 somewhere (won't be fixed for now)

Can you try to change in libraries\fabrik\fabrik\fabrik\Document\Renderer\Pdf\HeadRenderer.php line 72 to

$app->getDispatcher()->dispatch('onBeforeCompileHead'); //instead of $app->triggerEvent('onBeforeCompileHead');


The correspondending fix for "partial" (ajax forms, advanced search) is here
https://fabrikar.com/forums/index.p...work-with-fabrik-4-0-zeta-and-joomla-5.54204/
 
We librarians from public libraries have to collect every penny for Christmas (guess why), but I swear I'll donate after it.
 
Issues with child templates had been reported already for F4/J!4 somewhere (won't be fixed for now)

Can you try to change in libraries\fabrik\fabrik\fabrik\Document\Renderer\Pdf\HeadRenderer.php line 72 to

$app->getDispatcher()->dispatch('onBeforeCompileHead'); //instead of $app->triggerEvent('onBeforeCompileHead');


The correspondending fix for "partial" (ajax forms, advanced search) is here
https://fabrikar.com/forums/index.p...work-with-fabrik-4-0-zeta-and-joomla-5.54204/
I got the same error in the last version of Fabrik and Joomla

Joomla! 4.4.9 Stable [ Pamoja ] 15-October-2024 16:00 GMT
PHP 8.2.25
Version: 4.4.1 (GitDate: 2024-11-21)

I am using a child template of Cassiopea as default template but nothing change using default Cassiopeia,
Call stack
# Function Location
1 () JROOT/libraries/src/WebAsset/WebAssetRegistry.php:134
2 Joomla\CMS\WebAsset\WebAssetRegistry->get() JROOT/libraries/src/WebAsset/WebAssetManager.php:263
3 Joomla\CMS\WebAsset\WebAssetManager->useAsset() JROOT/libraries/src/WebAsset/WebAssetManager.php:197
4 Joomla\CMS\WebAsset\WebAssetManager->__call() JROOT/templates/cassiopeia/component.php:50
5 require() JROOT/libraries/src/Document/HtmlDocument.php:721
6 Joomla\CMS\Document\HtmlDocument->_loadTemplate() JROOT/libraries/src/Document/HtmlDocument.php:776
7 Joomla\CMS\Document\HtmlDocument->_fetchTemplate() JROOT/libraries/src/Document/HtmlDocument.php:612
8 Joomla\CMS\Document\HtmlDocument->parse() JROOT/libraries/src/Application/CMSApplication.php:1012
9 Joomla\CMS\Application\CMSApplication->render() JROOT/libraries/src/Application/SiteApplication.php:724
10 Joomla\CMS\Application\SiteApplication->render() JROOT/libraries/src/Application/CMSApplication.php:298
11 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:61
12 require_once() JROOT/index.php:32

Thank you
Enrico
 
Last edited:
No is not working, Same error. I also tested a joomlart template ( Ja simply ) but the result it's the same.
with original cassiopea work the pdf button in the list but not in details
 
Last edited:
Is it working with the original Cassiopeia?
...with original Cassiopeia as default style...

Cassiopeia child template (as default style) is not supported for PDFs.
 
Original cassiopea as default style is working but as menù assigned template style don't.

thanks for your help ( even if now I will have to redo all the template customizations :rolleyes:)
 
Not sure if it's a Fabrik or a Cassiopeia issue, Fabrik is just doing tmpl=component.

As a workaround (with child template as default) you can create a custom list resp. form/details template and add &templateStyle=X to the PDFurl (X is your parent Cassiopeia style id).

Then the PDFs will use parent Cassiopeia.
 
Great suggestion but i prefer to keep things simple
Furthermore, to generate the PDFs I would still have to repeat many customizations on Cassiopea (color, fonts, etc ...)
The "child templates" gave me some margins of possible future flexibility but they are not really essential.

Thank you very much, anyway
 

Members online

No members online now.
Back
Top