Hi,
I have a problem with generating pdf from article - it gives this error. It worked before update
Call to undefined method Joomla\CMS\Document\RawDocument::setHeader() in ...components\com_content\views\article\view.pdf.php on line 131
The same for other methods in that file.
I have tried at two websites, even with a default Joomla protostar template.
Joomla 3.8 - call to undefined method while generating a pdf
-
- Phoca Newbie
- Posts: 5
- Joined: 22 Sep 2017, 12:50
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Joomla 3.8 - call to undefined method while generating a pdf
Hi, Joomla! 3.8 is now full of issues, can you let me know all the errors, so I can take a look at it (unfortunately for now I don't know if I should change it in code or if it will be fixed in some of next Joomla! version)
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 22 Sep 2017, 12:50
Re: Joomla 3.8 - call to undefined method while generating a pdf
So far the only one.
The same error is also for these lines in view.pdf.php
$document->setArticleText($item->article_text);
$document->setArticleTitle($item->title);
Just a patch would be fine :), but if the new version is about to be released soon...
The same error is also for these lines in view.pdf.php
$document->setArticleText($item->article_text);
$document->setArticleTitle($item->title);
Just a patch would be fine :), but if the new version is about to be released soon...
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Joomla 3.8 - call to undefined method while generating a pdf
Hi, I can add the patch when I know, it is not a bug in Joomla! which will be fixed.
For now, just try to comment all the rows with $document:
FROM:
TO:
For now, just try to comment all the rows with $document:
FROM:
Code: Select all
$document = JFactory::getDocument();
$document->setHeader($this->getHeaderText($item, $params));
echo $item->text;
$document->setArticleText($item->article_text);
$document->setArticleTitle($item->title);
Code: Select all
//$document = JFactory::getDocument();
//$document->setHeader($this->getHeaderText($item, $params));
echo $item->text;
//$document->setArticleText($item->article_text);
//$document->setArticleTitle($item->title);
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 22 Sep 2017, 12:50
Re: Joomla 3.8 - call to undefined method while generating a pdf
Ok, thanks!
I have tried it - but the pdf is not generated - I get only a html page
I have tried it - but the pdf is not generated - I get only a html page
-
- Phoca Newbie
- Posts: 1
- Joined: 25 Sep 2017, 14:06
Re: Joomla 3.8 - call to undefined method while generating a pdf
I'm having the same issue, Commented those lines and just like alenah502, i only can have an html page.
So commenting just helps to give no error, but PDF isn't created
So commenting just helps to give no error, but PDF isn't created
-
- Phoca Newbie
- Posts: 3
- Joined: 25 Sep 2017, 15:41
Re: Joomla 3.8 - call to undefined method while generating a pdf
The document rendering seems completely reworked in Joomla 3.8, there is no JDocument class anymore, instead there is a Document class in libraries/src/Document/
Any estimate on how long it will take to achieve compatibility with 3.8 ?
Any estimate on how long it will take to achieve compatibility with 3.8 ?
-
- Phoca Newbie
- Posts: 3
- Joined: 25 Sep 2017, 15:41
Re: Joomla 3.8 - call to undefined method while generating a pdf
I managed to get it working again with the new Document class. I created a file libraries/src/Document/PdfDocument.php and put in there the contents of libraries/joomla/document/pdf/pdf.php, with some small changes to the code, most important of course to extend from Document instead of JDocument.
I also had to re-apply a fix I made earlier to administrator/components/com_phocapdf/helpers/phocapdfrender.php, in the default: case there was no $pdf object created. This was needed to use it with my custom component.
I also had to re-apply a fix I made earlier to administrator/components/com_phocapdf/helpers/phocapdfrender.php, in the default: case there was no $pdf object created. This was needed to use it with my custom component.
-
- Phoca Newbie
- Posts: 4
- Joined: 06 Sep 2017, 10:15
Re: Joomla 3.8 - call to undefined method while generating a pdf
Hi @janmisker,
I'm facing the same issue as you. Do you think you can share your modified files ?
Best regards,
Paul
I'm facing the same issue as you. Do you think you can share your modified files ?
Best regards,
Paul
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Joomla 3.8 - call to undefined method while generating a pdf
Hi @janmisker, yes, will be great if you can share the changes here.
Thank you, Jan
Thank you, Jan
If you find Phoca extensions useful, please support the project