I need to tcpdf (http://tcpdf.org/) library in magento2.2. I have added this library in Magento2.1.9 in lib/internal/TCPDF folder. In that, I have rename tcpdf.php class to TCPDF.php and tcpdf class to TCPDF_TCPDF and it was working fine.

But when I have used same in Magento2.2, it is not working and giving me error:

Uncaught Error: Class 'TCPDF_TCPDF' not found

Does any one have any idea that why there is issue with Magento new version and any solution for it ?

1 Answer 1


You will need to add the library and update corresponding dependencies using composer,use this composer wrapper to do so


Just follow steps given in the readme.

  • Thanks, But why earlier method is not working ? Add Custom library into lib/internal and use directly when required ?
    – Ajay
    Commented Oct 30, 2017 at 7:53
  • And suppose I have custom class which interact with linux based software then how can I add where there is no composer for it?
    – Ajay
    Commented Oct 30, 2017 at 7:54
  • It maybe because of the directory structure of file in master branch. Commented Oct 30, 2017 at 8:00
  • Was tcpdf.php located in lib/internal/TCPDF when you pasted the contents from zip? Commented Oct 30, 2017 at 8:00
  • Directory structure of master branch means? Mean am I using old magento2.2 ?
    – Ajay
    Commented Oct 30, 2017 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.