PHP Classes

Id doesnt work

Recommend this page to a friend!

      TCPDF Warper  >  All threads  >  Id doesnt work  >  (Un) Subscribe thread alerts  
Subject:Id doesnt work
Summary:Example doesnt render anything
Messages:7
Author:coffefive
Date:2015-01-07 13:56:50
 

  1. Id doesnt work   Reply   Report abuse  
Picture of coffefive coffefive - 2015-01-07 13:56:50
Could you do the working example? It wants some $file. If i put there any image or txt I've got an empty page.
$file = 'myimage.png';
pdf->buildImage()->setFile($file)

  2. Re: Id doesnt work   Reply   Report abuse  
Picture of Michal Kowalik Michal Kowalik - 2015-01-07 15:23:53 - In reply to message 1 from coffefive
I think you have missed render() call.

$file = 'myimage.png';
pdf->buildImage()
->setFile($file)
->render();

Alternatives are write/put (aliases).

PS: I was experimenting with calling render() in __destructor
so that it would not be necessarily to invoke every time, but
unfortunately the object is somehow released when executing
destructor (you can't call any methods on the object).

  3. Re: Id doesnt work   Reply   Report abuse  
Picture of coffefive coffefive - 2015-01-07 18:24:23 - In reply to message 2 from Michal Kowalik
Thank you for your answer. TCPDF is new for me. I just want to see what it can do. And therefore I may make shameful mistakes.

Unfortunately I have again white page. No errors, nothing.
Here is whole code of my example.php

include 'tcpdf/vendor/autoload.php';
include 'vendor/autoload.php';
error_reporting(E_ALL);
class PDF extends TCPDF {
use \org\majkel\tcpdfwarper\TCPDFWarperTrait;
}
$file = '14143073744500.jpg';
$pdf = new PDF();
$pdf->buildImage()->setFile($file)->render();

  4. Re: Id doesnt work   Reply   Report abuse  
Picture of Michal Kowalik Michal Kowalik - 2015-01-07 18:30:21 - In reply to message 3 from coffefive
I will than post complete working example withing few hours.

  5. Re: Id doesnt work   Reply   Report abuse  
Picture of Michal Kowalik Michal Kowalik - 2015-01-08 00:16:35 - In reply to message 3 from coffefive
Working example: examples/example-01.php
If inaccessible yet, goto: https://github.com/majkel89/tcpdf-warper/blob/master/examples/example-01.php

  6. Re: Id doesnt work   Reply   Report abuse  
Picture of coffefive coffefive - 2015-01-08 17:18:14 - In reply to message 5 from Michal Kowalik
Thanks a lot. Now it's really clear for me. That's very usefull.

  7. Re: Id doesnt work   Reply   Report abuse  
Picture of Michal Kowalik Michal Kowalik - 2015-01-08 19:24:43 - In reply to message 6 from coffefive
That is very nice to here.

I'm looking forward for any suggestions about further extending this tiny library.

PS: I'd be grateful if you rank me class if you really like it.