当前位置: 首页>>代码示例>>PHP>>正文


PHP Frame_Factory类代码示例

本文整理汇总了PHP中Frame_Factory的典型用法代码示例。如果您正苦于以下问题:PHP Frame_Factory类的具体用法?PHP Frame_Factory怎么用?PHP Frame_Factory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Frame_Factory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copy

 function copy(DomNode $node)
 {
     $frame = new Frame($node);
     $frame->set_style(clone $this->_frame->get_original_style());
     $deco = Frame_Factory::decorate_frame($frame);
     $deco->set_root($this->_root);
     return $deco;
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:8,代码来源:frame_decorator.cls.php

示例2: deep_copy

 function deep_copy()
 {
     $frame = new Frame($this->get_node()->cloneNode());
     $frame->set_style(clone $this->_frame->get_original_style());
     $deco = Frame_Factory::decorate_frame($frame, $this->_dompdf);
     $deco->set_root($this->_root);
     foreach ($this->get_children() as $child) {
         $deco->append_child($child->deep_copy());
     }
     return $deco;
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:11,代码来源:frame_decorator.cls.php

示例3: decorate_frame


//.........这里部分代码省略.........
             $positioner = "Block";
             $decorator = "Block";
             $reflower = "Block";
             break;
         case "-dompdf-list-bullet":
             if ($style->list_style_position === "inside") {
                 $positioner = "Inline";
             } else {
                 $positioner = "List_Bullet";
             }
             if ($style->list_style_image !== "none") {
                 $decorator = "List_Bullet_Image";
             } else {
                 $decorator = "List_Bullet";
             }
             $reflower = "List_Bullet";
             break;
         case "-dompdf-image":
             $positioner = "Inline";
             $decorator = "Image";
             $reflower = "Image";
             break;
         case "-dompdf-br":
             $positioner = "Inline";
             $decorator = "Inline";
             $reflower = "Inline";
             break;
         default:
             // FIXME: should throw some sort of warning or something?
         // FIXME: should throw some sort of warning or something?
         case "none":
             if ($style->_dompdf_keep !== "yes") {
                 // Remove the node and the frame
                 $frame->get_parent()->remove_child($frame);
                 return;
             }
             $positioner = "Null";
             $decorator = "Null";
             $reflower = "Null";
             break;
     }
     // Handle CSS position
     $position = $style->position;
     if ($position === "absolute") {
         $positioner = "Absolute";
     } else {
         if ($position === "fixed") {
             $positioner = "Fixed";
         }
     }
     $node = $frame->get_node();
     // Handle nodeName
     if ($node->nodeName === "img") {
         $style->display = "-dompdf-image";
         $decorator = "Image";
         $reflower = "Image";
     }
     $positioner .= "_Positioner";
     $decorator .= "_Frame_Decorator";
     $reflower .= "_Frame_Reflower";
     $deco = new $decorator($frame, $dompdf);
     $deco->set_positioner(new $positioner($deco));
     $deco->set_reflower(new $reflower($deco));
     if ($root) {
         $deco->set_root($root);
     }
     if ($display === "list-item") {
         // Insert a list-bullet frame
         $xml = $dompdf->get_dom();
         $bullet_node = $xml->createElement("bullet");
         // arbitrary choice
         $b_f = new Frame($bullet_node);
         $node = $frame->get_node();
         $parent_node = $node->parentNode;
         if ($parent_node) {
             if (!$parent_node->hasAttribute("dompdf-children-count")) {
                 $xpath = new DOMXPath($xml);
                 $count = $xpath->query("li", $parent_node)->length;
                 $parent_node->setAttribute("dompdf-children-count", $count);
             }
             if (is_numeric($node->getAttribute("value"))) {
                 $index = intval($node->getAttribute("value"));
             } else {
                 if (!$parent_node->hasAttribute("dompdf-counter")) {
                     $index = $parent_node->hasAttribute("start") ? $parent_node->getAttribute("start") : 1;
                 } else {
                     $index = $parent_node->getAttribute("dompdf-counter") + 1;
                 }
             }
             $parent_node->setAttribute("dompdf-counter", $index);
             $bullet_node->setAttribute("dompdf-counter", $index);
         }
         $new_style = $dompdf->get_css()->create_style();
         $new_style->display = "-dompdf-list-bullet";
         $new_style->inherit($style);
         $b_f->set_style($new_style);
         $deco->prepend_child(Frame_Factory::decorate_frame($b_f, $dompdf, $root));
     }
     return $deco;
 }
开发者ID:farzad1120,项目名称:tripexpress,代码行数:101,代码来源:frame_factory.cls.php

示例4: normalise

 /**
  * Restructure tree so that the table has the correct structure.
  * Invalid children (i.e. all non-table-rows) are moved below the
  * table.
  */
 function normalise()
 {
     // Store frames generated by invalid tags and move them outside the table
     $erroneous_frames = array();
     $anon_row = false;
     $iter = $this->get_first_child();
     while ($iter) {
         $child = $iter;
         $iter = $iter->get_next_sibling();
         $display = $child->get_style()->display;
         if ($anon_row) {
             if ($display === "table-row") {
                 // Add the previous anonymous row
                 $this->insert_child_before($table_row, $child);
                 $table_row->normalise();
                 $child->normalise();
                 $anon_row = false;
                 continue;
             }
             // add the child to the anonymous row
             $table_row->append_child($child);
             continue;
         } else {
             if ($display === "table-row") {
                 $child->normalise();
                 continue;
             }
             if ($display === "table-cell") {
                 // Create an anonymous table row
                 $tr = $this->get_node()->ownerDocument->createElement("tr");
                 $frame = new Frame($tr);
                 $css = $this->get_style()->get_stylesheet();
                 $style = $css->create_style();
                 $style->inherit($this->get_style());
                 // Lookup styles for tr tags.  If the user wants styles to work
                 // better, they should make the tr explicit... I'm not going to
                 // try to guess what they intended.
                 if ($tr_style = $css->lookup("tr")) {
                     $style->merge($tr_style);
                 }
                 // Okay, I have absolutely no idea why I need this clone here, but
                 // if it's omitted, php (as of 2004-07-28) segfaults.
                 $frame->set_style(clone $style);
                 $table_row = Frame_Factory::decorate_frame($frame, $this->_dompdf, $this->_root);
                 // Add the cell to the row
                 $table_row->append_child($child);
                 $anon_row = true;
                 continue;
             }
             if (!in_array($display, self::$VALID_CHILDREN)) {
                 $erroneous_frames[] = $child;
                 continue;
             }
             // Normalise other table parts (i.e. row groups)
             foreach ($child->get_children() as $grandchild) {
                 if ($grandchild->get_style()->display === "table-row") {
                     $grandchild->normalise();
                 }
             }
             // Add headers and footers
             if ($display === "table-header-group") {
                 $this->_headers[] = $child;
             } else {
                 if ($display === "table-footer-group") {
                     $this->_footers[] = $child;
                 }
             }
         }
     }
     if ($anon_row) {
         // Add the row to the table
         $this->_frame->append_child($table_row);
         $table_row->normalise();
         $this->_cellmap->add_row();
     }
     foreach ($erroneous_frames as $frame) {
         $this->move_after($frame);
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:84,代码来源:table_frame_decorator.cls.php

示例5: _set_content

 /**
  * Sets the generated content of a generated frame
  */
 protected function _set_content()
 {
     $frame = $this->_frame;
     $style = $frame->get_style();
     if ($style->content && $frame->get_node()->nodeName === "dompdf_generated") {
         $content = $this->_parse_content();
         $node = $frame->get_node()->ownerDocument->createTextNode($content);
         $new_style = $style->get_stylesheet()->create_style();
         $new_style->inherit($style);
         $new_frame = new Frame($node);
         $new_frame->set_style($new_style);
         Frame_Factory::decorate_frame($new_frame, $frame->get_dompdf());
         $new_frame->get_decorator()->set_root($frame->get_root());
         $frame->append_child($new_frame);
     }
 }
开发者ID:rodolfobais,项目名称:proylectura,代码行数:19,代码来源:frame_reflower.cls.php

示例6: render

 /**
  * Renders the HTML to PDF
  */
 function render()
 {
     $this->save_locale();
     $log_output_file = $this->get_option("log_output_file");
     if ($log_output_file) {
         if (!file_exists($log_output_file) && is_writable(dirname($log_output_file))) {
             touch($log_output_file);
         }
         $this->_start_time = microtime(true);
         ob_start();
     }
     //enable_mem_profile();
     $this->_process_html();
     $this->_css->apply_styles($this->_tree);
     // @page style rules : size, margins
     $page_styles = $this->_css->get_page_styles();
     $base_page_style = $page_styles["base"];
     unset($page_styles["base"]);
     foreach ($page_styles as $_page_style) {
         $_page_style->inherit($base_page_style);
     }
     if (is_array($base_page_style->size)) {
         $this->set_paper(array(0, 0, $base_page_style->size[0], $base_page_style->size[1]));
     }
     $this->_pdf = Canvas_Factory::get_instance($this, $this->_paper_size, $this->_paper_orientation);
     Font_Metrics::init($this->_pdf);
     if ($this->get_option("enable_font_subsetting") && $this->_pdf instanceof CPDF_Adapter) {
         foreach ($this->_tree->get_frames() as $frame) {
             $style = $frame->get_style();
             $node = $frame->get_node();
             // Handle text nodes
             if ($node->nodeName === "#text") {
                 $this->_pdf->register_string_subset($style->font_family, $node->nodeValue);
                 continue;
             }
             // Handle generated content (list items)
             if ($style->display === "list-item") {
                 $chars = List_Bullet_Renderer::get_counter_chars($style->list_style_type);
                 $this->_pdf->register_string_subset($style->font_family, $chars);
                 continue;
             }
             // Handle other generated content (pseudo elements)
             // FIXME: This only captures the text of the stylesheet declaration,
             //        not the actual generated content, and forces all possible counter
             //        values. See notes in issue #750.
             if ($frame->get_node()->nodeName == "dompdf_generated") {
                 // all possible counter values
                 $chars = List_Bullet_Renderer::get_counter_chars('decimal');
                 $this->_pdf->register_string_subset($style->font_family, $chars);
                 $chars = List_Bullet_Renderer::get_counter_chars('upper-alpha');
                 $this->_pdf->register_string_subset($style->font_family, $chars);
                 $chars = List_Bullet_Renderer::get_counter_chars('lower-alpha');
                 $this->_pdf->register_string_subset($style->font_family, $chars);
                 $chars = List_Bullet_Renderer::get_counter_chars('lower-greek');
                 $this->_pdf->register_string_subset($style->font_family, $chars);
                 // the text of the stylesheet declaration
                 $this->_pdf->register_string_subset($style->font_family, $style->content);
                 continue;
             }
         }
     }
     $root = null;
     foreach ($this->_tree->get_frames() as $frame) {
         // Set up the root frame
         if (is_null($root)) {
             $root = Frame_Factory::decorate_root($this->_tree->get_root(), $this);
             continue;
         }
         // Create the appropriate decorators, reflowers & positioners.
         Frame_Factory::decorate_frame($frame, $this, $root);
     }
     // Add meta information
     $title = $this->_xml->getElementsByTagName("title");
     if ($title->length) {
         $this->_pdf->add_info("Title", trim($title->item(0)->nodeValue));
     }
     $metas = $this->_xml->getElementsByTagName("meta");
     $labels = array("author" => "Author", "keywords" => "Keywords", "description" => "Subject");
     foreach ($metas as $meta) {
         $name = mb_strtolower($meta->getAttribute("name"));
         $value = trim($meta->getAttribute("content"));
         if (isset($labels[$name])) {
             $this->_pdf->add_info($labels[$name], $value);
             continue;
         }
         if ($name === "dompdf.view" && $this->parse_default_view($value)) {
             $this->_pdf->set_default_view($this->_default_view, $this->_default_view_options);
         }
     }
     $root->set_containing_block(0, 0, $this->_pdf->get_width(), $this->_pdf->get_height());
     $root->set_renderer(new Renderer($this));
     // This is where the magic happens:
     $root->reflow();
     // Clean up cached images
     Image_Cache::clear();
     global $_dompdf_warnings, $_dompdf_show_warnings;
     if ($_dompdf_show_warnings) {
//.........这里部分代码省略.........
开发者ID:keshvenderg,项目名称:cloudshop,代码行数:101,代码来源:dompdf.cls.php

示例7: render

 /**
  * Renders the HTML to PDF
  */
 function render()
 {
     $this->save_locale();
     if (DOMPDF_LOG_OUTPUT_FILE) {
         if (!file_exists(DOMPDF_LOG_OUTPUT_FILE) && is_writable(dirname(DOMPDF_LOG_OUTPUT_FILE))) {
             touch(DOMPDF_LOG_OUTPUT_FILE);
         }
         $this->_start_time = microtime(true);
         ob_start();
     }
     //enable_mem_profile();
     $this->_process_html();
     $this->_css->apply_styles($this->_tree);
     $root = null;
     foreach ($this->_tree->get_frames() as $frame) {
         // Set up the root frame
         if (is_null($root)) {
             $root = Frame_Factory::decorate_root($this->_tree->get_root(), $this);
             continue;
         }
         // Create the appropriate decorators, reflowers & positioners.
         $deco = Frame_Factory::decorate_frame($frame, $this);
         $deco->set_root($root);
         // FIXME: handle generated content
         if ($frame->get_style()->display === "list-item") {
             // Insert a list-bullet frame
             $node = $this->_xml->createElement("bullet");
             // arbitrary choice
             $b_f = new Frame($node);
             $parent_node = $frame->get_parent()->get_node();
             if (!$parent_node->hasAttribute("dompdf-children-count")) {
                 $count = 0;
                 foreach ($parent_node->childNodes as $_node) {
                     if ($_node instanceof DOMElement) {
                         $count++;
                     }
                 }
                 $parent_node->setAttribute("dompdf-children-count", $count);
             }
             $index = 0;
             if (!$parent_node->hasAttribute("dompdf-counter")) {
                 $index = 1;
                 $parent_node->setAttribute("dompdf-counter", 1);
             } else {
                 $index = $parent_node->getAttribute("dompdf-counter");
                 $index++;
                 $parent_node->setAttribute("dompdf-counter", $index);
             }
             $node->setAttribute("dompdf-counter", $index);
             $style = $this->_css->create_style();
             $style->display = "-dompdf-list-bullet";
             $style->inherit($frame->get_style());
             $b_f->set_style($style);
             $deco->prepend_child(Frame_Factory::decorate_frame($b_f, $this));
         }
     }
     $page_styles = $this->_css->get_page_styles();
     $base_page_style = $page_styles["base"];
     unset($page_styles["base"]);
     foreach ($page_styles as $_page_style) {
         $_page_style->inherit($base_page_style);
     }
     if (is_array($base_page_style->size)) {
         $this->set_paper(array(0, 0, $base_page_style->size[0], $base_page_style->size[1]));
     }
     $this->_pdf = Canvas_Factory::get_instance($this->_paper_size, $this->_paper_orientation);
     // Add meta information
     $title = $this->_xml->getElementsByTagName("title");
     if ($title->length) {
         $this->_pdf->add_info("Title", trim($title->item(0)->nodeValue));
     }
     $metas = $this->_xml->getElementsByTagName("meta");
     $labels = array("author" => "Author", "keywords" => "Keywords", "description" => "Subject");
     foreach ($metas as $meta) {
         $name = mb_strtolower($meta->getAttribute("name"));
         $value = trim($meta->getAttribute("content"));
         if (isset($labels[$name])) {
             $this->_pdf->add_info($labels[$name], $value);
             continue;
         }
         if ($name === "dompdf.view" && $this->parse_default_view($value)) {
             $this->_pdf->set_default_view($this->_default_view, $this->_default_view_options);
         }
     }
     $root->set_containing_block(0, 0, $this->_pdf->get_width(), $this->_pdf->get_height());
     $root->set_renderer(new Renderer($this));
     // This is where the magic happens:
     $root->reflow();
     // Clean up cached images
     Image_Cache::clear();
     global $_dompdf_warnings, $_dompdf_show_warnings;
     if ($_dompdf_show_warnings) {
         echo '<b>DOMPDF Warnings</b><br><pre>';
         foreach ($_dompdf_warnings as $msg) {
             echo $msg . "\n";
         }
         echo $this->get_canvas()->get_cpdf()->messages;
//.........这里部分代码省略.........
开发者ID:practo,项目名称:dompdf,代码行数:101,代码来源:dompdf.cls.php

示例8: render

 /**
  * Renders the HTML to PDF
  */
 function render()
 {
     //enable_mem_profile();
     $this->_process_html();
     $this->_css->apply_styles($this->_tree);
     $root = null;
     foreach ($this->_tree->get_frames() as $frame) {
         // Set up the root frame
         if (is_null($root)) {
             $root = Frame_Factory::decorate_root($this->_tree->get_root(), $this);
             continue;
         }
         // Create the appropriate decorators, reflowers & positioners.
         $deco = Frame_Factory::decorate_frame($frame, $this);
         $deco->set_root($root);
         // FIXME: handle generated content
         if ($frame->get_style()->display === "list-item") {
             // Insert a list-bullet frame
             $node = $this->_xml->createElement("bullet");
             // arbitrary choice
             $b_f = new Frame($node);
             $style = $this->_css->create_style();
             $style->display = "-dompdf-list-bullet";
             $style->inherit($frame->get_style());
             $b_f->set_style($style);
             $deco->prepend_child(Frame_Factory::decorate_frame($b_f, $this));
         }
     }
     $this->_pdf = Canvas_Factory::get_instance($this->_paper_size, $this->_paper_orientation);
     $root->set_containing_block(0, 0, $this->_pdf->get_width(), $this->_pdf->get_height());
     $root->set_renderer(new Renderer($this));
     // This is where the magic happens:
     $root->reflow();
     // Clean up cached images
     Image_Cache::clear();
     global $_dompdf_warnings, $_dompdf_show_warnings;
     if ($_dompdf_show_warnings) {
         echo '<b>DOMPDF Warnings</b><br><pre>';
         foreach ($_dompdf_warnings as $msg) {
             echo $msg . "\n";
         }
         echo $this->get_canvas()->get_cpdf()->messages;
         echo '</pre>';
         flush();
     }
 }
开发者ID:aodkrisda,项目名称:PHP-Digital-Format-Convert-Epub-Mobi-PDF,代码行数:49,代码来源:dompdf.cls.php

示例9: normalise

 function normalise()
 {
     $erroneous_frames = array();
     $anon_row = false;
     $iter = $this->get_first_child();
     while ($iter) {
         $child = $iter;
         $iter = $iter->get_next_sibling();
         $display = $child->get_style()->display;
         if ($anon_row) {
             if ($display === "table-row") {
                 $this->insert_child_before($table_row, $child);
                 $table_row->normalise();
                 $child->normalise();
                 $anon_row = false;
                 continue;
             }
             $table_row->append_child($child);
             continue;
         } else {
             if ($display === "table-row") {
                 $child->normalise();
                 continue;
             }
             if ($display === "table-cell") {
                 $tr = $this->get_node()->ownerDocument->createElement("tr");
                 $frame = new Frame($tr);
                 $css = $this->get_style()->get_stylesheet();
                 $style = $css->create_style();
                 $style->inherit($this->get_style());
                 if ($tr_style = $css->lookup("tr")) {
                     $style->merge($tr_style);
                 }
                 $frame->set_style(clone $style);
                 $table_row = Frame_Factory::decorate_frame($frame, $this->_dompdf);
                 $table_row->set_root($this->_root);
                 $table_row->append_child($child);
                 $anon_row = true;
                 continue;
             }
             if (!in_array($display, self::$VALID_CHILDREN)) {
                 $erroneous_frames[] = $child;
                 continue;
             }
             foreach ($child->get_children() as $grandchild) {
                 if ($grandchild->get_style()->display === "table-row") {
                     $grandchild->normalise();
                 }
             }
             if ($display === "table-header-group") {
                 $this->_headers[] = $child;
             } else {
                 if ($display === "table-footer-group") {
                     $this->_footers[] = $child;
                 }
             }
         }
     }
     if ($anon_row) {
         $this->_frame->append_child($table_row);
         $table_row->normalise();
         $this->_cellmap->add_row();
     }
     foreach ($erroneous_frames as $frame) {
         $this->move_after($frame);
     }
 }
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:67,代码来源:table_frame_decorator.cls.php

示例10: reflow

 function reflow()
 {
     $style = $this->_frame->get_style();
     $text = $this->_parse_content();
     $t_node = $this->_frame->get_node()->ownerDocument->createTextNode($text);
     $t_frame = new Frame($t_node);
     $t_style = $style->get_stylesheet()->create_style();
     $t_style->inherit($style);
     $t_frame->set_style($t_style);
     $this->_frame->prepend_child(Frame_Factory::decorate_frame($t_frame));
     $this->_reflower->reflow();
 }
开发者ID:NeCkEr,项目名称:CRUDGrid,代码行数:12,代码来源:generated_frame_reflower.cls.php

示例11: _set_content

 /**
  * Sets the generated content of a generated frame
  */
 protected function _set_content()
 {
     $frame = $this->_frame;
     $style = $frame->get_style();
     // if the element was pushed to a new page use the saved counter value, otherwise use the CSS reset value
     if ($style->counter_reset && ($reset = $style->counter_reset) !== "none") {
         $vars = preg_split('/\\s+/', trim($reset), 2);
         $frame->reset_counter($vars[0], isset($frame->_counters['__' . $vars[0]]) ? $frame->_counters['__' . $vars[0]] : (isset($vars[1]) ? $vars[1] : 0));
     }
     if ($style->counter_increment && ($increment = $style->counter_increment) !== "none") {
         $frame->increment_counters($increment);
     }
     if ($style->content && !$frame->get_first_child() && $frame->get_node()->nodeName === "dompdf_generated") {
         $content = $this->_parse_content();
         // add generated content to the font subset
         // FIXME: This is currently too late because the font subset has already been generated.
         //        See notes in issue #750.
         if ($frame->get_dompdf()->get_option("enable_font_subsetting") && $frame->get_dompdf()->get_canvas() instanceof CPDF_Adapter) {
             $frame->get_dompdf()->get_canvas()->register_string_subset($style->font_family, $content);
         }
         $node = $frame->get_node()->ownerDocument->createTextNode($content);
         $new_style = $style->get_stylesheet()->create_style();
         $new_style->inherit($style);
         $new_frame = new Frame($node);
         $new_frame->set_style($new_style);
         Frame_Factory::decorate_frame($new_frame, $frame->get_dompdf(), $frame->get_root());
         $frame->append_child($new_frame);
     }
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:32,代码来源:frame_reflower.cls.php

示例12: render

 /**
  * Renders the HTML to PDF
  */
 function render()
 {
     $this->_process_html();
     $this->_css->apply_styles($this->_tree);
     $root = null;
     foreach ($this->_tree->get_frames() as $frame) {
         // Set up the root frame
         if (is_null($root)) {
             $root = Frame_Factory::decorate_root($this->_tree->get_root());
             continue;
         }
         // Create the appropriate decorators, reflowers & positioners.
         $deco = Frame_Factory::decorate_frame($frame, $this);
         $deco->set_root($root);
         // FIXME: handle generated content
         if ($frame->get_style()->display == "list-item" && in_array($frame->get_style()->list_style_type, List_Bullet_Frame_Decorator::$BULLET_TYPES)) {
             // Insert a list-bullet frame
             $node = $this->_xml->createElement("bullet");
             // arbitrary choice
             $b_f = new Frame($node);
             $style = $this->_css->create_style();
             $style->display = "-dompdf-list-bullet";
             $style->inherit($frame->get_style());
             $b_f->set_style($style);
             $deco->prepend_child(Frame_Factory::decorate_frame($b_f));
         }
     }
     $this->_pdf = Canvas_Factory::get_instance($this->_paper_size, $this->_orientation);
     $root->set_containing_block(0, 0, $this->_pdf->get_width(), $this->_pdf->get_height());
     // This is where the magic happens:
     $root->reflow();
     $renderer = new Renderer($this->_pdf);
     $renderer->render($root);
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:37,代码来源:dompdf.cls.php

示例13: copy

 /**
  * Return a copy of this frame with $node as its node
  *
  * @param DOMNode $node
  *
  * @return Frame
  */
 function copy(DOMNode $node)
 {
     $frame = new Frame($node);
     $frame->set_style(clone $this->_frame->get_original_style());
     return Frame_Factory::decorate_frame($frame, $this->_dompdf, $this->_root);
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:13,代码来源:frame_decorator.cls.php

示例14: _set_content

 /**
  * Sets the generated content of a generated frame
  */
 protected function _set_content()
 {
     $frame = $this->_frame;
     $style = $frame->get_style();
     if ($style->counter_reset && ($reset = $style->counter_reset) !== "none") {
         $vars = preg_split('/\\s+/', trim($reset), 2);
         $frame->reset_counter($vars[0], isset($vars[1]) ? $vars[1] : 0);
     }
     if ($style->counter_increment && ($increment = $style->counter_increment) !== "none") {
         $frame->increment_counters($increment);
     }
     if ($style->content && !$frame->get_first_child() && $frame->get_node()->nodeName === "dompdf_generated") {
         $content = $this->_parse_content();
         $node = $frame->get_node()->ownerDocument->createTextNode($content);
         $new_style = $style->get_stylesheet()->create_style();
         $new_style->inherit($style);
         $new_frame = new Frame($node);
         $new_frame->set_style($new_style);
         Frame_Factory::decorate_frame($new_frame, $frame->get_dompdf(), $frame->get_root());
         $frame->append_child($new_frame);
     }
 }
开发者ID:pankajsinghjarial,项目名称:SYLC-NEWSITE,代码行数:25,代码来源:frame_reflower.cls.php

示例15: render

 function render()
 {
     $this->save_locale();
     if (DOMPDF_LOG_OUTPUT_FILE) {
         if (!file_exists(DOMPDF_LOG_OUTPUT_FILE) && is_writable(dirname(DOMPDF_LOG_OUTPUT_FILE))) {
             touch(DOMPDF_LOG_OUTPUT_FILE);
         }
         $this->_start_time = microtime(true);
         ob_start();
     }
     $this->_process_html();
     $this->_css->apply_styles($this->_tree);
     $page_styles = $this->_css->get_page_styles();
     $base_page_style = $page_styles["base"];
     unset($page_styles["base"]);
     foreach ($page_styles as $_page_style) {
         $_page_style->inherit($base_page_style);
     }
     if (is_array($base_page_style->size)) {
         $this->set_paper(array(0, 0, $base_page_style->size[0], $base_page_style->size[1]));
     }
     $this->_pdf = Canvas_Factory::get_instance($this->_paper_size, $this->_paper_orientation);
     Font_Metrics::init($this->_pdf);
     if (DOMPDF_ENABLE_FONTSUBSETTING && $this->_pdf instanceof CPDF_Adapter) {
         foreach ($this->_tree->get_frames() as $frame) {
             $style = $frame->get_style();
             $node = $frame->get_node();
             if ($node->nodeName === "#text") {
                 $this->_pdf->register_string_subset($style->font_family, $node->nodeValue);
                 continue;
             }
             if ($style->display === "list-item") {
                 $chars = List_Bullet_Renderer::get_counter_chars($style->list_style_type);
                 $this->_pdf->register_string_subset($style->font_family, $chars);
                 continue;
             }
         }
     }
     $root = null;
     foreach ($this->_tree->get_frames() as $frame) {
         if (is_null($root)) {
             $root = Frame_Factory::decorate_root($this->_tree->get_root(), $this);
             continue;
         }
         $deco = Frame_Factory::decorate_frame($frame, $this);
         $deco->set_root($root);
         if ($frame->get_style()->display === "list-item") {
             $node = $this->_xml->createElement("bullet");
             $b_f = new Frame($node);
             $parent_node = $frame->get_parent()->get_node();
             if (!$parent_node->hasAttribute("dompdf-children-count")) {
                 $xpath = new DOMXPath($this->_xml);
                 $count = $xpath->query("li", $parent_node)->length;
                 $parent_node->setAttribute("dompdf-children-count", $count);
             }
             if (!$parent_node->hasAttribute("dompdf-counter")) {
                 $index = $parent_node->hasAttribute("start") ? $parent_node->getAttribute("start") - 1 : 0;
             } else {
                 $index = $parent_node->getAttribute("dompdf-counter");
             }
             $index++;
             $parent_node->setAttribute("dompdf-counter", $index);
             $node->setAttribute("dompdf-counter", $index);
             $style = $this->_css->create_style();
             $style->display = "-dompdf-list-bullet";
             $style->inherit($frame->get_style());
             $b_f->set_style($style);
             $deco->prepend_child(Frame_Factory::decorate_frame($b_f, $this));
         }
     }
     $title = $this->_xml->getElementsByTagName("title");
     if ($title->length) {
         $this->_pdf->add_info("Title", trim($title->item(0)->nodeValue));
     }
     $metas = $this->_xml->getElementsByTagName("meta");
     $labels = array("author" => "Author", "keywords" => "Keywords", "description" => "Subject");
     foreach ($metas as $meta) {
         $name = mb_strtolower($meta->getAttribute("name"));
         $value = trim($meta->getAttribute("content"));
         if (isset($labels[$name])) {
             $this->_pdf->add_info($labels[$name], $value);
             continue;
         }
         if ($name === "dompdf.view" && $this->parse_default_view($value)) {
             $this->_pdf->set_default_view($this->_default_view, $this->_default_view_options);
         }
     }
     $root->set_containing_block(0, 0, $this->_pdf->get_width(), $this->_pdf->get_height());
     $root->set_renderer(new Renderer($this));
     $root->reflow();
     Image_Cache::clear();
     global $_dompdf_warnings, $_dompdf_show_warnings;
     if ($_dompdf_show_warnings) {
         echo '<b>DOMPDF Warnings</b><br><pre>';
         foreach ($_dompdf_warnings as $msg) {
             echo $msg . "\n";
         }
         echo $this->get_canvas()->get_cpdf()->messages;
         echo '</pre>';
         flush();
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:101,代码来源:dompdf.cls.php


注:本文中的Frame_Factory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。