src/Parsing/Html.php
protected function getHtmlFromRealPage($html)
    {
        // set body tag to lower case
        $html = str_replace('<BODY', '<body', $html);
        $html = str_replace('</BODY', '</body', $html);

        // explode from the body tag. If no body tag => end
        $res = explode('<body', $html);

        // the html content is between body tag openning and closing
        $content = '<page'.$res[1];
        $content = explode('</body', $content);
        $content = $content[0].'</page>';

        // extract the link tags from the original html
        // and add them before the content
        preg_match_all('/<link ([^>]*)[\/]?>/isU', $html, $match);
        foreach ($match[1] as $src) {
            $content = '<link '.$src.'/>'.$content;
        }

        // extract the css style tags from the original html
        // and add them before the content
        preg_match_all('/<style[^>]*>(.*)<\/style[^>]*>/isU', $html, $match);
        foreach ($match[0] as $src) {
            $content = $src.$content;
        }

        return $content;
    }
protected function getHtmlFromRealPage($html)
    {
        // set body tag to lower case
        $html = str_replace('<BODY', '<body', $html);
        $html = str_replace('</BODY', '</body', $html);

        // explode from the body tag. If no body tag => end
        $res = explode('<body', $html);

        // the html content is between body tag openning and closing
        $content = '<page'.$res[1];
        $content = explode('</body', $content);
        $content = $content[0].'</page>';

        // extract the link tags from the original html
        // and add them before the content
        preg_match_all('/<link ([^>]*)[\/]?>/isU', $html, $match);
        foreach ($match[1] as $src) {
            $content = '<link '.$src.'/>'.$content;
        }

        // extract the css style tags from the original html
        // and add them before the content
        preg_match_all('/<style[^>]*>(.*)<\/style[^>]*>/isU', $html, $match);
        foreach ($match[0] as $src) {
            $content = $src.$content;
        }

        return $content;
    }
protected function getHtmlFromRealPage ( $ html ) { // set body tag to lower case $ html = str_replace ( '<BODY' , '<body' , $ html ) ; $ html = str_replace ( '</BODY' , '</body' , $ html ) ; // explode from the body tag. If no body tag => end $ res = explode ( '<body' , $ html ) ; // the html content is between body tag openning and closing $ content = '<page' . $ res [ 1 ] ; $ content = explode ( '</body' , $ content ) ; $ content = $ content [ 0 ] . '</page>' ; // extract the link tags from the original html // and add them before the content preg_match_all ( '/<link ([^>]*)[\/]?>/isU' , $ html , $ match ) ; foreach ( $ match [ 1 ] as $ src ) { $ content = '<link ' . $ src . '/>' . $ content ; } // extract the css style tags from the original html // and add them before the content preg_match_all ( '/<style[^>]*>(.*)<\/style[^>]*>/isU' , $ html , $ match ) ; foreach ( $ match [ 0 ] as $ src ) { $ content = $ src . $ content ; } return $ content ; }
convert the HTML of a real page, to a code adapted to Html2Pdf

@param  string $html HTML code of a real page
@return string HTML adapted to Html2Pdf
convert the HTML of a real page to a code adapted to Html2Pdf