English (United Kingdom)

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/wp-content/plugins/vikrentcar/admin/resources/company_logo.jpg"
then it's because your server has some restrictions accessing the files from the absolute server path generated by the WordPress 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:
/wp-content/plugins/vikrentcar/site/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/wp-content/plugins/vikrentcar/site/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 wp-content/plugins/vikrentcar/.

Last Update: 2019-11-29
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information