dompdf incompatibility with php7

1

Greetings!

I was working with PHP Version 5.4.3 and with DOMPDF (to print the pdf form in pdf format); When I upgrade to PHP Version 7.2.1 I get the following error:

  

Fatal error: Uncaught DOMPDF_Exception: No block-level parent found. Not good. in C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ inline_positioner.cls.php: 38 Stack trace: # 0 C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ frame_decorator.cls.php (546 ): Inline_Positioner-> position () # 1 C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ text_frame_reflower.cls.php (331): Frame_Decorator-> position () # 2 C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ frame_decorator.cls.php (556): Text_Frame_Reflower-> reflow (NULL) # 3 C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ page_frame_reflower.cls.php (138 ): Frame_Decorator-> reflow () # 4 C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ frame_decorator.cls.php (556): Page_Frame_Reflower-> reflow (NULL) # 5 C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ dompdf.cls.php (817): Frame_Decorator-> reflow () # 6 C: \ xampp \ htdocs \ ctacobro_6 \ production \ Impresion.php (859): DOMPDF- > render () # 7 {main} thrown in C: \ xampp \ htdocs \ ctacobro_6 \ production \ dompdf \ include \ inline_positioner.cls.php on line 38

here is the code:

<?php
$code='aquí va el html'
// se crea una nueva instancia al DOMPDF
$dompdf = new Dompdf();
// se carga el codigo html
$dompdf->load_html(utf8_decode($code));
// aumentamos memoria del servidor si es necesario
ini_set("memory_limit","50M"); 
// lanzamos a render
$dompdf->render();
// guardamos a PDF
$dompdf->stream("PA03-PR04-F02.pdf");
$bd_certsup2->close();
?>

The Dompdf 0.8.1 and Dompdf 0.8.2 versions do not work for me either.

Thank you very much!

    
asked by Jefferson 29.01.2018 в 16:21
source

1 answer

0

It's very strange, but of all the possible solutions found in forums and other pages, the only one that worked for me was this:

Remove the blank space between the following elements

<html><head> </head><body> </body></html>

There are no problems with the blank space anywhere else in the file.

The solution for:

  

@benabbottnz commented on 26 Sep 2017 in link

PDT: PHP Version 7.2.1 / DOMPDF 0.6.0 beta 3 release notes

Greetings!

    
answered by 30.01.2018 в 15:17