I am trying to add a fixed header on every page with pagination with dompdf, just for some reasons is not recognizing the methods:
require("NWIT.dompdf/dompdf_config.inc.php");
class NWIT_REPORTGEN extends NWIT_RAMS{
protected $pdfdom;
function __construct() {
$this->pdfdom = new DOMPDF();
}
function generate_report() {
$name_of_generated_report = 'hello';
$font = Font_Metrics::get_font("helvetica", "normal");
$size = 9;
$y = $this->pdfdom->get_height() - 24;
$x = $this->pdfdom->get_width() - 15 - Font_Metrics::get_text_width("1/1", $font, $size);
$fixed_header = $this->pdfdom->page_text($x, $y, "{PAGE_NUM}/{PAGE_COUNT}", $font, $size);
$some_html = '<html></html><br><br>hellor</br><body></html>';
$content = $fixed_header.$some_html;
$this->pdfdom->load_html($content);
$this->pdfdom->set_paper('a4', 'landscape');
$this->pdfdom->render();
$this->pdfdom->stream(array($name_of_generated_report, 0, 1, 0)); //for testing
}
}
I also tried adding in the fixed header a string like <html><body><script type="text/php".....
, but nothing shows up so that is why I added the code like this, to see the error, and error is:
Fatal error: Call to undefined method DOMPDF::get_height() in line 13
This is very odd cause I instantieted the class in the constructor and it is working fine for methods load_html
, set_paper
, render
and stream