New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ordered lists #14
Comments
From sven.rym...@gmail.com on June 24, 2009 06:28:54 Modify dompdf.cls.php as documented below: // 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);
//---NEW CODE---
$index = 0;
if(!$frame->get_parent()->get_node()->hasAttribute("-dompdf-counter"))
{
$index = 1;
$frame->get_parent()->get_node()->setAttribute("-dompdf-counter", 1);
}
else
{
$index = $frame->get_parent()->get_node()->getAttribute("-dompdf-counter");
$index++;
$frame->get_parent()->get_node()->setAttribute("-dompdf-counter", $index);
}
$node->setAttribute("-dompdf-counter", $index);
//---END NEW CODE---
$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) );
} Next modify the file list_bullet_renderer.cls.php (switch statement): case "none": // Already documented in another thread.
break;
case "decimal": // Here you go, the ordered list stuff!
list($x, $y) = $frame->get_position();
$index = $frame->get_node()->getAttribute("-dompdf-counter");
$text = sprintf('%d.', $index);
$font = $style->font_family;
$size = $style->font_size;
$height = $style->height;
$spacing = 0; //$frame->get_text_spacing() + $style->word_spacing;
if ( preg_replace("/[\s]+/", "", $text) == "" )
return;
$this->_canvas->text($x, $y, $text,
$font, $size,
$style->color, $spacing);
$x += Font_Metrics::get_text_width($text, $style->font_family,
$style->font_size, $spacing);
break; The outline of the list can be better, so you should modify the Hope this helps in making dompdf even better. |
From tobias.t...@gmail.com on October 20, 2009 14:42:09 I needed this for more ordered list types (roman, alpha, etc.) TT |
From charlie....@gmail.com on February 17, 2010 23:17:17 For anyone needing them, attached are the 2 files with the updated code. |
From ryan.mas...@gmail.com on March 11, 2010 23:11:28 |
From blorri...@gmail.com on March 21, 2010 18:47:29 Any suggestions? |
From fabien.menager on March 25, 2010 12:37:59 |
From eclecticgeek on June 24, 2010 19:08:59 Sander Bol reported this problem and supplied a fix. |
From fabien.menager on July 27, 2010 19:55:01 |
From zlatea.a...@redkiwi.ro on October 04, 2012 11:29:15 Have solved someone the issue with margin styling? thank you |
From eclecticgeek on October 04, 2012 18:14:28 |
…owed path(s) Hello! So I had a weird error in my Laravel project using the libs `dompdf/dompdf`, `barryvdh/laravel-dompdf` and `laraveldaily/laravel-invoices` The function `Dompdf\\Cpdf->openFont()` were called with an empty $font, it was on shared hosting with open_basedir restrictions. Here is the full stacktrace: ``` [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Helvetica [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Times-Bold [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-Bold [2021-10-20 20:23:47] production.INFO: FONT LOADED: [2021-10-20 20:23:47] production.ERROR: file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) {"userId":1,"exception":"[object] (ErrorException(code: 0): file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) at /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php:3341) [stacktrace] #0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError() dompdf#1 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3341): file_exists() dompdf#2 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3549): Dompdf\\Cpdf->openFont() dompdf#3 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Adapter/CPDF.php(1030): Dompdf\\Cpdf->selectFont() dompdf#4 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(327): Dompdf\\Adapter\\CPDF->get_text_width() dompdf#5 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(294): Dompdf\\FontMetrics->getTextWidth() dompdf#6 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53) : eval()'d code(6): Dompdf\\FontMetrics->get_text_width() dompdf#7 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53): eval() dompdf#8 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(61): Dompdf\\PhpEvaluator->evaluate() dompdf#9 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(293): Dompdf\\PhpEvaluator->render() dompdf#10 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(138): Dompdf\\Renderer->_render_frame() dompdf#11 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\\Renderer->render() dompdf#12 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameReflower/Page.php(148): Dompdf\\Renderer->render() dompdf#13 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\\FrameReflower\\Page->reflow() dompdf#14 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Dompdf.php(838): Dompdf\\FrameDecorator\\AbstractFrameDecorator->reflow() dompdf#15 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(208): Dompdf\\Dompdf->render() dompdf#16 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(155): Barryvdh\\DomPDF\\PDF->render() ``` The `FONT LOADED` part was to log the current font and was placed just above where the error was at `Cpdf.php(3341)`
…owed path(s) Hello! So I had a weird error in my Laravel project using the libs `dompdf/dompdf`, `barryvdh/laravel-dompdf` and `laraveldaily/laravel-invoices` The function `Dompdf\\Cpdf->openFont()` were called with an empty $font, it was on shared hosting with open_basedir restrictions. Here is the full stacktrace: ``` [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Helvetica [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Times-Bold [2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-Bold [2021-10-20 20:23:47] production.INFO: FONT LOADED: [2021-10-20 20:23:47] production.ERROR: file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) {"userId":1,"exception":"[object] (ErrorException(code: 0): file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) at /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php:3341) [stacktrace] #0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError() dompdf#1 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3341): file_exists() dompdf#2 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3549): Dompdf\\Cpdf->openFont() dompdf#3 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Adapter/CPDF.php(1030): Dompdf\\Cpdf->selectFont() dompdf#4 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(327): Dompdf\\Adapter\\CPDF->get_text_width() dompdf#5 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(294): Dompdf\\FontMetrics->getTextWidth() dompdf#6 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53) : eval()'d code(6): Dompdf\\FontMetrics->get_text_width() dompdf#7 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53): eval() dompdf#8 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(61): Dompdf\\PhpEvaluator->evaluate() dompdf#9 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(293): Dompdf\\PhpEvaluator->render() dompdf#10 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(138): Dompdf\\Renderer->_render_frame() dompdf#11 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\\Renderer->render() dompdf#12 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameReflower/Page.php(148): Dompdf\\Renderer->render() dompdf#13 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\\FrameReflower\\Page->reflow() dompdf#14 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Dompdf.php(838): Dompdf\\FrameDecorator\\AbstractFrameDecorator->reflow() dompdf#15 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(208): Dompdf\\Dompdf->render() dompdf#16 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(155): Barryvdh\\DomPDF\\PDF->render() ``` The `FONT LOADED` part was to log the current font and was placed just above where the error was at `Cpdf.php(3341)`
Original author: ryan.mas...@gmail.com (April 29, 2009 18:09:51)
What would you like dompdf to do:
ordered lists are currently not supported
Original issue: http://code.google.com/p/dompdf/issues/detail?id=7
The text was updated successfully, but these errors were encountered: