本文整理汇总了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
//.........这里部分代码省略.........