I'm trying to combine 2 different scripts
- Autoprint - http://www.fpdf.org/en/script/script36.php
- TFPDF - http://www.fpdf.org/en/script/script92.php
Each script is working on its own as expected but I want them to work together. I tried searching but there's no similar situation as what I am facing. I tried combining different classes as suggested here but couldn't get it to work.
This is what I tried:
require('fpdf/pdf_js.php');
require('fpdf/tfpdf.php');
class PDF_AutoPrint extends PDF_JavaScript
{
function AutoPrint($printer='')
{
if($printer)
{
$printer = str_replace('\\', '\\\\', $printer);
$script = "var pp = getPrintParams();";
$script .= "pp.interactive = pp.constants.interactionLevel.full;";
$script .= "pp.printerName = '$printer'";
$script .= "print(pp);";
}
else
$script = 'print(true);';
$this->IncludeJS($script);
}
}
$pdf = new tFPDF(new PDF_AutoPrint());
It is giving me this error:
Catchable fatal error: Object of class PDF_AutoPrint could not be converted to string
Any help would be greatly appreciated.