Remo's Guide -- PDF Gen -- generate_pdf returns stdClass not mpdf object

Permalink
I've installed the PDF block from Remo's book -- which is an excellent guide.

When I attempt to create a PDF of a page by calling the generate_pdf program in tools, it uses the Loader to load the mpdf class library.

Something apparently is instantiated with the new mpdf call. But, it apparently is a stdClass rather than an mpdf object, so no method calls are recognized. I've looked through the mpdf class but not found any obvious clues that a stdClass is being returned in case the environment isn't set up properly.

I would assume that the Loader call isn't set properly, but I'm not sure how to test this.

Here's the code:
Loader::library ('mpdf54/mpdf');
$mdpf = new mPDF ('utf-8', 'letter') ;
$mpdf->showImageErrors = true;
$mpdf->SetCreator ('PDF by concrete5') ; // undefined method on stdClass
$mpdf->useOnlyCoreFonts = true;
$mpdf->SetBasePath ($url);
$mpdf->WriteHTML ($header . $content) ;
$mpdf->Output() ;

 
Mnkras replied on at Permalink Reply
Mnkras
That is not an issue with Loader::library, all that simply does is check a couple paths for the library then include it.

The problem is either with your code or the library.

Mike
jvansanten replied on at Permalink Reply
Thanks, Mike.
Mnkras replied on at Permalink Best Answer Reply
Mnkras
found your issue,

$mdpf

it should be
$mpdf
jvansanten replied on at Permalink Reply
Still learning PHP and its behavior when everything isn't quite right. This is a good lesson.

I appreciate your taking the time to review the code to find the simple misspelling. Dyslexia strikes again.

All the best.
Mnkras replied on at Permalink Reply
Mnkras
Yea no problem, when I run into an issue like that I step through the code using print_r() or var_dump() on the variables.
jvansanten replied on at Permalink Reply
Thanks, Mike.