How to Use our Joomla® Extensions e4j Knowledge Base

TCPDF Errors

If during the generation of the PDF file, 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_vikrentcar/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 PDF Contract/Agreement. The file is in the following directory of your server:
/components/com_vikrentcar/helpers/pdf_tmpl.php

By downloading the Template-File with an FTP client and by opening it with a good text-editor, you will find a special syntax like the one below:
{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 {logo} to an image tag like the following:

<img src="images/path_to_your_company_logo.jpg" />

Once you have modified the file, save the modifications and upload it back onto your server via FTP by overwriting the existing file.

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 TCPDF class for PHP may return during the generation of the PDF file is the following:
"TCPDF ERROR: Can't open image file: /path/to/server/components/com_vikrentcar/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:

  1. Make sure to grant permission to the whole folder and sub-folders "cache". The whole folder should have a 0755 permission.
  2. 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_vikrentcar/ as well as /administrator/components/com_vikrentcar/.

Last Update: 2015-07-07
Helpful?
67% of people found this helpful.

Extensionsforjoomla.com is not affiliated with or endorsed by the Joomla!® Project or Open Source Matters.
The Joomla!® name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
E4J s.r.l. - VAT N. 06794860483

This site uses cookies. By continuing to browse you accept their use. Further information