Martes Rd
Martes Rd

Reputation: 103

TCPDF is not working with CakePHP 2.0

I found this great article:

http://bakery.cakephp.org/articles/kalileo/2010/06/08/creating-pdf-files-with-cakephp-and-tcpdf

And it works fine with CakePHP 1.2, but I tried it with CakePHP 2.0 and the same Code results just a page with many strange characters.

Obviously there has something changed in CakePHP 2.0, but what is it?

Upvotes: 2

Views: 2232

Answers (2)

TiCL
TiCL

Reputation: 145

Latest TCPDF works fine with Cakephp 2.0. The 'problem' you are having is mostly likely the browser displaying the PDF inline as html. It is caused by spurious whitespace at the end of controller/view files that causes the browser to assume text/html mimetype instead of PDF.

Upvotes: 3

Moz Morris
Moz Morris

Reputation: 6761

There have been a lot of 'breaking changes' from CakePHP versions 1.x to 2.x.

I have only looked at the TCPDF code briefly, but I would recommend you trying to update the code so that it works with 2.0. The main relevant changes are naming conventions and loading of Vendor files.

Follow the migration guide, and if you do manage to get it working, contact the author and share the code! Good luck :)

Upvotes: 0

Related Questions