I’m currently working on a PHP project focused on PDF report generation. To develop locally, I’m using MAMP Pro 1.9 and TCPDF 4.9.018. Upon installation of TCPDF, I encountered the following error:

MAMP 403
TCPDF ERROR: Could not include font definition file: helvetica

To fix these issue:

  1. Check your log files; they will most likely provide additional details about the error your encountering. In my case, the log stated: “Directory index forbidden by rule”. Ensure that proper permissions are applied to the “tcpdf” folder.
  2. Configure the “tcpdf” > “config” > tcpdf_config.php file properly. There are two settings that you need to modify based on your local environment:

define ('K_PATH_MAIN', $k_path_main);
define ('K_PATH_URL', $k_path_url);
1
2
define ('K_PATH_MAIN', $k_path_main);
define ('K_PATH_URL', $k_path_url);
  1. Set K_PATH_MAIN to your local “tcpdf” installation directory. Don’t forget the trailing “/”. If you omit the trailing “/” it will cause multiple issues regarding path references when you try to access tcpdf. For example: “/var/www/tcpdf/”.
  2. Set K_PATH_URL to your URL path to tcpdf installation folder. For example: “http://localhost/tcpdf/”.

Tagged with:
 

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>