TCPDF Errors
VikBooking uses the PHP Class TCPDF for generating the invoices. Any error stating 'TCPDF' means that there was a problem with the generation of the PDF file.
If during the generation of the PDF file for the Invoice, the system outputs a blank page with an error similar to:
"TCPDF ERROR: [Image] Unable to get image: /your/server/absolute/path/administrator/components/com_vikbooking/resources/company_logo.jpg"
then it's because your server has some restrictions accessing the files from the absolute server path generated by the Joomla! Framework.
Usually this happens on some Virtual Hosts sharing a part of the full server path. Most of the times the Hosting Company is able to grant permissions to your virtual host domain-space to access the files from the absolute path but when this is not possible, it is necessary to convert the path of the image file that could not be fetched, to a relative path. This error message is referring to the Company Logo that could not be fetched.
In order to change the path of the image to a relative path, you should open the Template-File used for the generation of the Invoices in PDF format. The file is in the following directory of your server:
/components/com_vikbooking/helpers/invoices/invoice_tmpl.php
You do not need to edit the file via FTP, you can do it directly from the Configuration page, 3rd tab, by clicking on the Edit Template File button next to the label 'Invoices Template'. The same error could be raised for the generation of the Check-in Document, which has its own dedicated template file, still modifiable from the Configuration page. The solution suggested below is valid for all template files that produce PDF files.
By opening the PHP Template file, you will find a special syntax like the one below:
{company_logo}
That special syntax should be changed to an actual image tag with the relative path to the logo of your company so that your server will no longer issue that error message. The logo should obviously be present onto your server, onto the folder /images or on any sub-folder of it. At this point, just replace the special syntax {company_logo} to an image tag like the following:
<img src="images/path_to_your_company_logo.jpg" />
It is important to keep the same structure of the IMG tag as the example above. This way the system will be able to fetch the company logo from both front-end and back-end. If you need to add any HTML Attribute to the IMG tag, you should do it after the SRC attribute because that must be the very first attribute of the tag.
Another Error that that the famous PHP Class TCPDF may return during the generation of the PDF file is the following:
"TCPDF ERROR: Can't open image file: /path/to/server/components/com_vikbooking/helpers/tcpdf/cache/mska_8a811...."
In this case the issue is not caused by the server path but rather to a files permission issue.
In order to fix such errors, there are two operations you should make on your server with an FTP client like FileZilla:
- Make sure to grant permission to the whole folder and sub-folders "cache". The whole folder should have a 0755 permission.
- Empty the folder "cache" by removing all the cache files inside it. The folder "cache" should be completely empty, the only file you may want to leave is the index.html. All the other files should be removed.
If you keep getting the same error even after doing such modifications then it's because the Files Permissions are not correctly set. In that case, use the same FTP client to grant 0755 permission to all files, folders and sub-folders of /components/com_vikbooking/ as well as /administrator/components/com_vikbooking/.