本文整理匯總了PHP中Stylesheet::get_dompdf方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stylesheet::get_dompdf方法的具體用法?PHP Stylesheet::get_dompdf怎麽用?PHP Stylesheet::get_dompdf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Stylesheet
的用法示例。
在下文中一共展示了Stylesheet::get_dompdf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
/**
* Converts any CSS length value into an absolute length in points.
*
* length_in_pt() takes a single length (e.g. '1em') or an array of
* lengths and returns an absolute length. If an array is passed, then
* the return value is the sum of all elements.
*
* If a reference size is not provided, the default font size is used
* ({@link Style::$default_font_size}).
*
* @param float|array $length the length or array of lengths to resolve
* @param float $ref_size an absolute reference size to resolve percentage lengths
* @return float
*/
function length_in_pt($length, $ref_size = null)
{
static $cache = array();
if (!is_array($length)) {
$length = array($length);
}
if (!isset($ref_size)) {
$ref_size = self::$default_font_size;
}
$key = implode("@", $length) . "/{$ref_size}";
if (isset($cache[$key])) {
return $cache[$key];
}
$ret = 0;
foreach ($length as $l) {
if ($l === "auto") {
return "auto";
}
if ($l === "none") {
return "none";
}
// Assume numeric values are already in points
if (is_numeric($l)) {
$ret += $l;
continue;
}
if ($l === "normal") {
$ret += $ref_size;
continue;
}
// Border lengths
if ($l === "thin") {
$ret += 0.5;
continue;
}
if ($l === "medium") {
$ret += 1.5;
continue;
}
if ($l === "thick") {
$ret += 2.5;
continue;
}
if (($i = mb_strpos($l, "px")) !== false) {
$dpi = $this->_stylesheet->get_dompdf()->get_option("dpi");
$ret += mb_substr($l, 0, $i) * 72 / $dpi;
continue;
}
if (($i = mb_strpos($l, "pt")) !== false) {
$ret += (double) mb_substr($l, 0, $i);
continue;
}
if (($i = mb_strpos($l, "%")) !== false) {
$ret += (double) mb_substr($l, 0, $i) / 100 * $ref_size;
continue;
}
if (($i = mb_strpos($l, "rem")) !== false) {
$ret += (double) mb_substr($l, 0, $i) * $this->_stylesheet->get_dompdf()->get_tree()->get_root()->get_style()->font_size;
continue;
}
if (($i = mb_strpos($l, "em")) !== false) {
$ret += (double) mb_substr($l, 0, $i) * $this->__get("font_size");
continue;
}
if (($i = mb_strpos($l, "cm")) !== false) {
$ret += mb_substr($l, 0, $i) * 72 / 2.54;
continue;
}
if (($i = mb_strpos($l, "mm")) !== false) {
$ret += mb_substr($l, 0, $i) * 72 / 25.4;
continue;
}
// FIXME: em:ex ratio?
if (($i = mb_strpos($l, "ex")) !== false) {
$ret += mb_substr($l, 0, $i) * $this->__get("font_size") / 2;
continue;
}
if (($i = mb_strpos($l, "in")) !== false) {
$ret += (double) mb_substr($l, 0, $i) * 72;
continue;
}
if (($i = mb_strpos($l, "pc")) !== false) {
$ret += (double) mb_substr($l, 0, $i) * 12;
continue;
}
// Bogus value
//.........這裏部分代碼省略.........