Ejemplo n.º 1
0
    /**
     * convert HTML to PDF
     *
     * @access public
     * @param  string   $html
     * @param  boolean  $debugVue  enable the HTML debug vue
     * @return null
     */
    public function writeHTML($html, $debugVue = false)
    {
        // if it is a real html page, we have to convert it
        if (preg_match('/<body/isU', $html))
            $html = $this->getHtmlFromPage($html);

        $html = str_replace('[[date_y]]', date('Y'), $html);
        $html = str_replace('[[date_m]]', date('m'), $html);
        $html = str_replace('[[date_d]]', date('d'), $html);

        $html = str_replace('[[date_h]]', date('H'), $html);
        $html = str_replace('[[date_i]]', date('i'), $html);
        $html = str_replace('[[date_s]]', date('s'), $html);

        // If we are in HTML debug vue : display the HTML
        if ($debugVue) {
            return $this->_vueHTML($html);
        }

        // convert HTMl to PDF
        $this->parsingCss->readStyle($html);
        $this->parsingHtml->setHTML($html);
        $this->parsingHtml->parse();
        $this->_makeHTMLcode();
    }