elibyy / tcpdf-laravel

TCPDF helper for laravel
MIT License
313 stars 74 forks source link

TCPDF functions missing? #43

Closed matiasah closed 6 years ago

matiasah commented 6 years ago

image image image image I'm having some issues with the library, I'm not sure if I'm doing anything wrong. It also throws errors when trying to use any other method; SetTitle, SetAuthor, AddPage, etc.

elibyy commented 6 years ago

Hey there, if you are using the facade pattern you are not suppose to do new TCPDF() but instead TCPDF::Output('boleta.pdf','I') and so on

Please note that if you intend on generating more than one PDF you should use the reset method

Hope this helps

matiasah commented 6 years ago

image image I can't seem to be getting it either way.

elibyy commented 6 years ago

That's odd. Can you please try and provide the following:

Also, The reset is only required at the end and only if you are in a loop, by default there's no need for it

matiasah commented 6 years ago

image That's the output, doesn't seem to be null.

image

matiasah commented 6 years ago

Now, I renamed the 'TCPDF' alias to just 'PDF'. I don't know why, but it fixes the issue.

elibyy commented 6 years ago

Yup, just figured it out too. Apparently PHP allows you to override classes using class_alias (which laravel uses internally for anything you specify in aliases array in config/app.php). So my class TCPDFHelper extends \TCPDF translates into class TCPDFHelper extends \Elibyy\TCPDF\Facades\TCPDF that doesn't have the method AddPage