4
I’m using mPDF
to generate the PDF:
$this->load->helper('mpdf');
$this->data['dadosboleto'] = $this->boleto_model->GerarBoletoCEF($id_cliente, $data_inicial, $data_final);
$this->data['view'] = 'boleto/boleto';
$this->load->view('tema/topo',$this->data);
$html = $this->load->view('boleto/boleto_impressao', $this->data, true);
pdf_create($html, 'boleto_'.$id_cliente."_". date('d-m-Y'), TRUE);
The error you make when generating is:
PHP Error was encountered
Severity: 8192 Message: preg_replace(): The /e Modifier is deprecated, use preg_replace_callback Instead Filename: mpdf/mpdf.php Line Number: 31592
This error only happens if I have HTML inside the View being generated, if I have only one echo "teste"
it works normally.
I’m using the Codeigniter framework.
Addendum:
Based on our friend Yure’s answer, it stayed that way:
And this would be the way to appear correctly in the PDF:
What can it be? Here is the view: http://pastebin.com/FZ0apNcy for being very extensive, I preferred to put in Pastebin.
As you can see in the warning, the function
preg_replace()
this depreciated ie, it is no longer recommended to use it because the functionpreg_replace_callback
this replacing it, you can consult the php documentation for more information http://php.net/manual/en/function.preg-replace-callback.php– RFL
Hmmmm, but how do I do it? Because it’s a file of 32,000 lines or so that gave this error... You can post an example?
– Sr. André Baill
Try to get the latest version of mPDF maybe this error has already been fixed.
– rray
In fact, it is not the preg_replace() function that is depreciated, but rather the use of the modifier and along with it, where it is recommended to use the preg_replace_callback() function in these cases..
– Yure Pereira
@Yurepereira yes... that’s what I imagined, because when I pass a test parameter only, that is, an echo "test", comes the normal PDF... but when I print something in html and php, it presents the error
– Sr. André Baill
@Andrebaill Tries to use the ob_clean() function to clear the output buffer.
– Yure Pereira
Where I put?
– Sr. André Baill
Could be a problem with my CSS @Yurepereira ?
– Sr. André Baill
Before calling $mpdf->Output method();
– Yure Pereira
Let’s go continue this discussion in chat.
– Sr. André Baill