0

I am using TCPDF to create pdf in joomla. I have include tcpdf.php using require_once and it is successfully included but when I am creating object of TCPDF class gives fatel error: TCPDF class not found ;

Thanks

Roopendra
  • 7,674
  • 16
  • 65
  • 92
Vishal Thoriya
  • 283
  • 5
  • 19
  • How do you verify its successfully included? – Roopendra Dec 20 '13 at 10:32
  • Which file did you add `require_once` to? – Lodder Dec 20 '13 at 10:37
  • i have place tcpdf folder in public_html and set require_once(JURI::root().'tcpdf/tcpdf.php'); – Vishal Thoriya Dec 20 '13 at 10:58
  • You can't use `JURI::root()` in a custom PHP file unless you import the Joomla framework in the file too. This answer gives you the code to put at the top of your PHP file which will import the framework: http://stackoverflow.com/a/12665691/1362108 – Lodder Dec 20 '13 at 11:01
  • sir require_once(JURI::root().'tcpdf/tcpdf.php'); this i have write in joomla view file so JURI is working correctly i have check by echo it gives me correct path – Vishal Thoriya Dec 20 '13 at 11:12
  • Which view file have you added it to? It might be possible that you have added it to a view file that isn't being used on that specific page. Try adding it to your template index.php file instead – Lodder Dec 20 '13 at 11:19

2 Answers2

0

You need to replace this code:

require_once(JURI::root().'tcpdf/tcpdf.php');

with

require_once(JPATH_ROOT . '/tcpdf/tcpdf.php');
di3sel
  • 2,002
  • 15
  • 24
0

Open the tcpdf_include.php file and change the $tcpdf_include_dirs array values (line 30) as per your requirement or just directly include the tcpdf.php

I did something like this and it working...

require_once('tcpdf.php')

my tcpdf_include.php and tcpdf.php files are in same folder.

hope this will help.