/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orienation of the document (either 'landscape' or 'portrait') */ function __construct($paper = "letter", $orientation = "portrait") { if (is_array($paper)) { $size = $paper; } else { if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[mb_strtolower($paper)]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (mb_strtolower($orientation) === "landscape") { list($size[2], $size[3]) = array($size[3], $size[2]); } $this->_pdf = new Cpdf($size, DOMPDF_UNICODE_ENABLED, DOMPDF_FONT_CACHE, DOMPDF_TEMP_DIR); $this->_pdf->addInfo("Creator", "DOMPDF"); $time = substr_replace(date('YmdHisO'), '\'', -2, 0) . '\''; $this->_pdf->addInfo("CreationDate", "D:{$time}"); $this->_pdf->addInfo("ModDate", "D:{$time}"); $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orientation of the document (either 'landscape' or 'portrait') * @param DOMPDF $dompdf The DOMPDF instance */ function __construct($paper = "letter", $orientation = "portrait", DOMPDF $dompdf) { if (is_array($paper)) { $size = $paper; } elseif (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[mb_strtolower($paper)]; } else { $size = self::$PAPER_SIZES["letter"]; } if (mb_strtolower($orientation) === "landscape") { list($size[2], $size[3]) = array($size[3], $size[2]); } $this->_dompdf = $dompdf; $this->_pdf = new Cpdf($size, $dompdf->get_option("enable_unicode"), $dompdf->get_option("font_cache"), $dompdf->get_option("temp_dir")); $this->_pdf->addInfo("Creator", "DOMPDF"); $time = substr_replace(date('YmdHisO'), '\'', -2, 0) . '\''; $this->_pdf->addInfo("CreationDate", "D:{$time}"); $this->_pdf->addInfo("ModDate", "D:{$time}"); $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orienation of the document (either 'landscape' or 'portrait') */ function __construct($paper = "letter", $orientation = "portrait") { if (is_array($paper)) { $size = $paper; } else { if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[$paper]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (mb_strtolower($orientation) == "landscape") { $a = $size[3]; $size[3] = $size[2]; $size[2] = $a; } $this->_pdf = new Cpdf($size); $this->_pdf->addInfo("Creator", "DOMPDF Converter"); // Silence pedantic warnings about missing TZ settings if (function_exists("date_default_timezone_get")) { $tz = @date_default_timezone_get(); date_default_timezone_set("UTC"); $this->_pdf->addInfo("CreationDate", date("Y-m-d")); date_default_timezone_set($tz); } else { $this->_pdf->addInfo("CreationDate", date("Y-m-d")); } $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_pdf->openHere('Fit'); $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orienation of the document (either 'landscape' or 'portrait') */ function __construct($paper = "letter", $orientation = "portrait") { if (is_array($paper)) { $size = $paper; } else { if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[mb_strtolower($paper)]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (mb_strtolower($orientation) === "landscape") { $a = $size[3]; $size[3] = $size[2]; $size[2] = $a; } $this->_pdf = new Cpdf($size, DOMPDF_UNICODE_ENABLED, DOMPDF_FONT_CACHE, DOMPDF_TEMP_DIR); $this->_pdf->addInfo("Creator", "dompdf"); // Silence pedantic warnings about missing TZ settings $time = substr_replace(date('YmdHisO'), '\'', 0 - 2, 0) . '\''; $this->_pdf->addInfo("CreationDate", "D:" . $time); $this->_pdf->addInfo("ModDate", "D:" . $time); $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_pdf->openHere('Fit'); $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF::$PAPER_SIZES}) * @param string $orientation The orientation of the document (either 'landscape' or 'portrait') * @param Dompdf $dompdf The Dompdf instance */ function __construct($paper = "letter", $orientation = "portrait", Dompdf $dompdf) { if (is_array($paper)) { $size = $paper; } else { if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[mb_strtolower($paper)]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (mb_strtolower($orientation) === "landscape") { list($size[2], $size[3]) = array($size[3], $size[2]); } $this->_dompdf = $dompdf; $this->_pdf = new \Cpdf($size, true, $dompdf->getOptions()->getFontCache(), $dompdf->getOptions()->getTempDir()); $this->_pdf->addInfo("Producer", sprintf("%s + CPDF", $dompdf->version)); $time = substr_replace(date('YmdHisO'), '\'', -2, 0) . '\''; $this->_pdf->addInfo("CreationDate", "D:{$time}"); $this->_pdf->addInfo("ModDate", "D:{$time}"); $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orientation of the document (either 'landscape' or 'portrait') * @param DOMPDF $dompdf The DOMPDF instance */ function __construct($paper = "letter", $orientation = "portrait", DOMPDF $dompdf) { $size = $this->get_size($paper, $orientation); $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_dompdf = $dompdf; $this->_pdf = new Cpdf($size, $dompdf->get_option("enable_unicode"), $dompdf->get_option("font_cache"), $dompdf->get_option("temp_dir")); $this->_pdf->addInfo("Creator", "DOMPDF"); $time = substr_replace(date('YmdHisO'), '\'', -2, 0) . '\''; $this->_pdf->addInfo("CreationDate", "D:{$time}"); $this->_pdf->addInfo("ModDate", "D:{$time}"); $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orienation of the document (either 'landscape' or 'portrait') */ function __construct($paper = "letter", $orientation = "portrait") { if (is_array($paper)) { $size = $paper; } else { if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[$paper]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (mb_strtolower($orientation) == "landscape") { $a = $size[3]; $size[3] = $size[2]; $size[2] = $a; } // OAR - Setting isUnicode to true by default! // Some people may not want to do this. Should we have // a DOMPDF config variable somewhere that lets people // choose? $this->_pdf = new Cpdf($size, true); $this->_pdf->addInfo("Creator", "dompdf"); // Silence pedantic warnings about missing TZ settings if (function_exists("date_default_timezone_get")) { $tz = @date_default_timezone_get(); date_default_timezone_set("UTC"); $this->_pdf->addInfo("CreationDate", date("Y-m-d")); date_default_timezone_set($tz); } else { $this->_pdf->addInfo("CreationDate", date("Y-m-d")); } $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_pdf->openHere('Fit'); $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }