Re: How Joomla 3.8 generates PDF now? Lack of pdf.php, new libraries structure

Started by Adwans, March 23, 2018, 16:24:49 PM

Previous topic - Next topic

Adwans

Hello Guys,
I finally got everything updated up to VM. 3.2.12 and J! 3.8.6
Since J! 3.8 many things changed  - you know - e.g. before  I had PDFs generated just using format=pdf in Urls.
Now, with me trying to use this, new joomla gives an error:
QuoteCall to undefined method Joomla\CMS\Document\RawDocument::setName()
Looks like redirecting me to RawDocument instead of PdfDocument.
Is there any other location with PdfDocument class since J! 3.8 ? How it works now?
maybe my question is funny,  but I'm new to Joomla 3.8 changes.

jenkinhill

Obviously really a question for the Joomla forum, but pdf generation was removed from Joomla some versions ago.  There are extensions to generate pdfs, though in the JED
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Adwans

#2
You are absolutely right, I will ask on J Forum, but VM also generates PDF using TCPDF and something changed with Joomla 3.18.
I know that native Joomla generation was removed years ago.
Maybe any hint?

Studio 42

Here native PDF https://github.com/studio42/joomla-pdf-document-view, i dont use it anymore, but should work as you need.
It use any PDF libraries, you can donwload packages from here http://studio42.github.io/joomla-pdf-document-view/index.html or use any you want.
If you can install wkhtmltopdf(need a dedicated server) you can render wysiwyg print quality.

Adwans

#4
Ok, but it is impossibile  to use - AFAIK - libraries/joomla/document/pdf/pdf.php coz newest Joomla does not use libraries/joomla/document -
we have libraries/src/Document
Phoca gallery faced same problem recently. Do we have any equivalent of pdf.php
@jenkinhill, this is not a sole J! problem, since pdf.php belongs to VM stuff.  ;)

Studio 42

Hum, i dont have see it, you are right, they changed all, path, filename, classname ....
I perhaps update it, but not for now, i dont know how long it take to do all changes.

jenkinhill

VirtueMart uses its own version of tcpdf for generating invoices & delivery notes, com_tcpdf_1.0.4.zip in the VM installation package puts the files in  /libraries/tcpdf
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Adwans

QuoteVersion: 1.0.4 of February 2015
TCPDF 6.2.12 by Nicola Asuni. Joomla Installer by the VirtueMart Team
Already on board...
It makes nothing. 
Lack of pdf.php is a problem. Do you really have :
/libraries/tcpdf
in Joomla 3.8.+ ?
EDIT: Joomla 3.8 of course... :D

Studio 42

Quote from: jenkinhill on March 25, 2018, 13:10:13 PM
VirtueMart uses its own version of tcpdf for generating invoices & delivery notes, com_tcpdf_1.0.4.zip in the VM installation package puts the files in  /libraries/tcpdf
You have the answer : Virtuemart do not support anymore the creation of PDF excluding invoices & delivery notes.
Joomla 3 never supported PDF in core.

Adwans

Quote from: Studio 42 on March 26, 2018, 21:31:42 PM
Quote from: jenkinhill on March 25, 2018, 13:10:13 PM
VirtueMart uses its own version of tcpdf for generating invoices & delivery notes, com_tcpdf_1.0.4.zip in the VM installation package puts the files in  /libraries/tcpdf
You have the answer : Virtuemart do not support anymore the creation of PDF excluding invoices & delivery notes.
Joomla 3 never supported PDF in core.
1. We dont have /libraries/tcpdf , so VM cannot put here anything anymore. Sorry, its nonsense. Although, thank You for information. As you told - everything has changed
QuoteHum, i dont have see it, you are right, they changed all, path, filename, classname ....
2. I need  to create pdf from some "orders" before an invoice number is set. Before J 3.8 I did it with a little help from "details_pdf.php" file and "pdf.php" . 
3. Tell me please - 
Quotei dont use it anymore, but should work as you need.
- do You use different PDF library /solution?
3. Getting closer to quit Joomla - considering updates of this sort.  After 8 years. Thank you for help though.

jenkinhill

Quote from: Adwans on March 27, 2018, 09:29:04 AM

1. We dont have /libraries/tcpdf , so VM cannot put here anything anymore. Sorry, its nonsense. Although, thank You for information. As you told - everything has changed


The VM tcpdf component (com_tcpdf_1.0.4.zip) creates library/tcpdf in Joomla on installation.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Studio 42

Quote from: Adwans on March 27, 2018, 09:29:04 AM
3. Getting closer to quit Joomla - considering updates of this sort.  After 8 years. Thank you for help though.
No framework support PDF anymore, and Joomla removed PDF core support since more then 2 or 3 years.
If you need it you can use plugins to add PDF support.
I explained that if you modify my plugin https://github.com/studio42/joomla-pdf-document-view, you can use it with all Joomla extentions and all view on adding a PDF button.
Here someexplain http://studio42.github.io/joomla-pdf-document-view/developper.html
Note that i simplified the task,
Before the view.pdf.php was madatory.
In my plugin it fallback to view.html.php, so it have chance to work in many case.

Adwans

@Kelvyn  You're right, i meant \document.
@Studio 42, thank you, I had created PdfDocument using Document, still no effect but "error" .  And now - your posts inspired me i will try more. Till (positive) effect.   

Adwans

Hello again, Im still working on adapting PdfDocument file to work along with new Document class.
And now i got:
QuoteError: Class 'Joomla\CMS\Document\TCPDF' not found: Class 'Joomla\CMS\Document\TCPDF' not found
Where it could be - what I cannot find?
Regards!
EDIT:
Backslash repaired this issue:
$this->_engine = new \TCPDF();
It works now  - my PdfDocument.php file - with Document class!  8) :D

Studio 42

Can you send the code? perhaps i update github, so you are not restricted to only one  PDF renderer Class.