public function outputFN($type) { // manda effettivamente al browser la pagina oppure solo i dati (dimensioni, testo, ...)) switch ($type) { case 'page': // standard // standard default: $data = $this->htmlheader; $data .= $this->htmlbody; $data .= $this->htmlfooter; print $data; break; case 'dimension': $data = $this->htmlheader; $data .= $this->htmlbody; $data .= $this->htmlfooter; $dim_data = strlen($data); print $dim_data; break; case 'text': $data = $this->htmlheader; $data .= $this->htmlbody; $data .= $this->htmlfooter; $text_data = strip_tags($data); print $text_data; break; case 'source': // debugging purpose only $data = $this->htmlheader; $data .= $this->htmlbody; $data .= $this->htmlfooter; $source_data = htmlentities($data, ENT_COMPAT | ENT_HTML401, ADA_CHARSET); print $source_data; break; case 'error': // debugging purpose only $data = $this->error; print $data; break; case 'file': // useful for caching pages $data = $this->htmlheader; $data .= $this->htmlbody; $data .= $this->htmlfooter; $fp = fopen($this->full_static_filename, "w"); $result = fwrite($fp, $data); fclose($fp); break; case 'pdf': $data = $this->htmlheader; $data .= $this->htmlbody; $data .= $this->htmlfooter; require_once ROOT_DIR . '/include/dompdf/dompdf_config.inc.php'; $dompdf_options = array("default_media_type" => 'print', "default_paper_size" => 'a4', "enable_unicode" => DOMPDF_UNICODE_ENABLED, "enable_php" => DOMPDF_ENABLE_PHP, "enable_remote" => true, "enable_css_float" => true, "enable_javascript" => true, "enable_html5_parser" => DOMPDF_ENABLE_HTML5PARSER, "enable_font_subsetting" => DOMPDF_ENABLE_FONTSUBSETTING); $dompdf = new DOMPDF(); $dompdf->set_options($dompdf_options); $dompdf->set_paper('a4', $this->orientation); $dompdf->load_html($data); $dompdf->render(); $dompdf->stream($this->outputfile . '.pdf', array('Attachment' => 0)); die; break; } }