Giter Club home page Giter Club logo

dompdf's Introduction

Dompdf

Build Status Latest Release Total Downloads License

Dompdf is an HTML to PDF converter

At its heart, dompdf is (mostly) a CSS 2.1 compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes.

This document applies to the latest stable code which may not reflect the current release. For released code please navigate to the appropriate tag.


Check out the demo and ask any question on StackOverflow or in Discussions.

Follow us on Twitter.


Features

  • Handles most CSS 2.1 and a few CSS3 properties, including @import, @media & @page rules
  • Supports most presentational HTML 4.0 attributes
  • Supports external stylesheets, either local or through http/ftp (via fopen-wrappers)
  • Supports complex tables, including row & column spans, separate & collapsed border models, individual cell styling
  • Image support (gif, png (8, 24 and 32 bit with alpha channel), bmp & jpeg)
  • No dependencies on external PDF libraries, thanks to the R&OS PDF class
  • Inline PHP support
  • Basic SVG support (see "Limitations" below)

Requirements

  • PHP version 7.1 or higher
  • DOM extension
  • MBString extension
  • php-font-lib
  • php-svg-lib

Note that some required dependencies may have further dependencies (notably php-svg-lib requires sabberworm/php-css-parser).

Recommendations

  • GD (for image processing)
    • Additionally, the IMagick or GMagick extension improves image processing performance for certain image types
  • OPcache (OPcache, XCache, APC, etc.): improves performance

Visit the wiki for more information: https://github.com/dompdf/dompdf/wiki/Requirements

About Fonts & Character Encoding

PDF documents internally support the following fonts: Helvetica, Times-Roman, Courier, Zapf-Dingbats, & Symbol. These fonts only support Windows ANSI encoding. In order for a PDF to display characters that are not available in Windows ANSI, you must supply an external font. Dompdf will embed any referenced font in the PDF so long as it has been pre-loaded or is accessible to dompdf and reference in CSS @font-face rules. See the font overview for more information on how to use fonts.

The DejaVu TrueType fonts have been pre-installed to give dompdf decent Unicode character coverage by default. To use the DejaVu fonts reference the font in your stylesheet, e.g. body { font-family: DejaVu Sans; } (for DejaVu Sans). The following DejaVu 2.34 fonts are available: DejaVu Sans, DejaVu Serif, and DejaVu Sans Mono.

Easy Installation

Install with composer

To install with Composer, simply require the latest version of this package.

composer require dompdf/dompdf

Make sure that the autoload file from Composer is loaded.

// somewhere early in your project's loading, require the Composer autoloader
// see: http://getcomposer.org/doc/00-intro.md
require 'vendor/autoload.php';

Download and install

Download a packaged archive of dompdf and extract it into the directory where dompdf will reside

Use the packaged release autoloader to load dompdf, libraries, and helper functions in your PHP:

// include autoloader
require_once 'dompdf/autoload.inc.php';

Note: packaged releases are named according using semantic versioning (dompdf_MAJOR-MINOR-PATCH.zip). So the 1.0.0 release would be dompdf_1-0-0.zip. This is the only download that includes the autoloader for Dompdf and all its dependencies.

Install with git

From the command line, switch to the directory where dompdf will reside and run the following commands:

git clone https://github.com/dompdf/dompdf.git
cd dompdf/lib

git clone https://github.com/PhenX/php-font-lib.git php-font-lib
cd php-font-lib
git checkout 0.5.1
cd ..

git clone https://github.com/PhenX/php-svg-lib.git php-svg-lib
cd php-svg-lib
git checkout v0.3.2
cd ..

git clone https://github.com/sabberworm/PHP-CSS-Parser.git php-css-parser
cd php-css-parser
git checkout 8.1.0

Require dompdf and it's dependencies in your PHP. For details see the autoloader in the utils project.

Quick Start

Just pass your HTML in to dompdf and stream the output:

// reference the Dompdf namespace
use Dompdf\Dompdf;

// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('hello world');

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF to Browser
$dompdf->stream();

Setting Options

Set options during dompdf instantiation:

use Dompdf\Dompdf;
use Dompdf\Options;

$options = new Options();
$options->set('defaultFont', 'Courier');
$dompdf = new Dompdf($options);

or at run time

use Dompdf\Dompdf;

$dompdf = new Dompdf();
$options = $dompdf->getOptions();
$options->setDefaultFont('Courier');
$dompdf->setOptions($options);

See Dompdf\Options for a list of available options.

Resource Reference Requirements

In order to protect potentially sensitive information Dompdf imposes restrictions on files referenced from the local file system or the web.

Files accessed through web-based protocols have the following requirements:

  • The Dompdf option "isRemoteEnabled" must be set to "true"
  • PHP must either have the curl extension enabled or the allow_url_fopen setting set to true

Files accessed through the local file system have the following requirement:

  • The file must fall within the path(s) specified for the Dompdf "chroot" option

Limitations (Known Issues)

  • Table cells are not pageable, meaning a table row must fit on a single page.
  • Elements are rendered on the active page when they are parsed.
  • Embedding "raw" SVG's (<svg><path...></svg>) isn't working yet, you need to either link to an external SVG file, or use a DataURI like this:
    $html = '<img src="data:image/svg+xml;base64,' . base64_encode($svg) . '" ...>';
    Watch #320 for progress
  • Does not support CSS flexbox.
  • Does not support CSS Grid.
  • A single Dompdf instance should not be used to render more than one HTML document because persisted parsing and rendering artifacts can impact future renders.

Donate button

If you find this project useful, please consider making a donation. Any funds donated will be used to help further development on this project.)

dompdf's People

Contributors

amacneil avatar andreasnij avatar barryvdh avatar bsweeney avatar cyrille37 avatar doubleslash avatar eddturtle avatar enumag avatar erikn69 avatar fabwu avatar flaviencrochard avatar gabrielbull avatar godrar avatar ionbazan avatar lquast avatar mellthas avatar nappa85 avatar phenx avatar phpgangsta avatar powerkiki avatar rsanzante avatar rudiedirkx avatar samuferenc avatar simonberger avatar spreeuw avatar staabm avatar stollr avatar thomaslandauer avatar tomlankhorst avatar williamdes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dompdf's Issues

Font family not parsed correctly

Original author: eclecticgeek (June 03, 2009 16:07:07)

What steps will reproduce the problem?

  1. Create an HTML document that has a style definition that includes
    font-family (can also test with the font tag with a face attribute).
  2. The value for font-family should include font alternatives (e.g.
    verdana, arial, sans-serif).
  3. The value for font-family should use ", " to separate the font alternatives.

What is the expected output? What do you see instead?
The list should be parsed and each font family alternative processed
separately. However, DOMPDF appears to parse a font-family list correctly
only if no space is included. Instead, DOMPDF treats a list of alternative
fonts that use ", " for the delimiter as a single font name.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=22

Paper Size Not Accurately Set

Original author: eclecticgeek (June 24, 2009 14:37:12)

What steps will reproduce the problem?

  1. Set DOMPDF to use the CPDF adapter.
  2. Specify A4 as the paper size when rendering a document.

What is the expected output? What do you see instead?
Rather than create a document using a paper size of A4, DOMPDF runs until
memory is exhausted (on my test system). I am not certain exactly what
DOMPDF is attempting to create when it is passed an invalid page size.

The source of the problem is in the constructor function of the
CPDF_Adapter class (cpdf_adapter.cls.php). When checking for a match in the
array of paper sizes the code accurately forces lowercase, but does not
force lowercase when setting the paper size, resulting in the paper size
being set to a NULL value.

References
http://groups.google.com/group/dompdf/browse_thread/thread/d3cf6accb0ab7fb4

Original issue: http://code.google.com/p/dompdf/issues/detail?id=32

Undefined index in class.pdf.php

Original author: [email protected] (June 22, 2009 00:27:14)

Hello
Problem with dompdf 5-0-1, I get the following error :
Notice: Undefined index: 2 in C:\Program Files\EasyPHP 3.0
\www\rafael\administrator\components\com_virtuemart\classes\pdf\dompdf\lib
class.pdf.php on line 1216

When put this line n°1216, I get my PDF file correctly.
Would anybody tell me what is wrong or is it a bug.
I use PHP 5.10 the latest release. I used dompdf to output pdf files in
joomla component Virtumart.
Here is my code :

elseif( file_exists(CLASSPATH."pdf/dompdf/dompdf_config.inc.php")) {
        // In this part you can use the dompdf library  (http://www.digitaljunkies.ca/dompdf/)
        // Just extract the dompdf archive to /classes/pdf/dompdf

        $image_details = getimagesize($logo);

        $footer = '<script type="text/php">

if ( isset($pdf) ) {

  // Open the object: all drawing commands will
  // go to the object instead of the current page
  $footer = $pdf->open_object();

  $w = $pdf->get_width();
  $h = $pdf->get_height();

  // Draw a line along the bottom
  $y = $h - 2 * 12 - 24;
  $pdf->line(16, $y, $w - 16, $y, "grey", 1);

  // Add a logo
  $img_w = 2 * 72; // 2 inches, in points
  $img_h = 1 * 72; // 1 inch, in points -- change these as required
  $pdf->image("'.$logourl.'", "'.$image_details[2].'", ($w - $img_w) /  2.0, $y - $img_h, $img_w, $img_h);

  // Close the object (stop capture)
  $pdf->close_object();
  // Add the object to every page. You can
  // also specify "odd" or "even"
  $pdf->add_object($footer, "all");

}
</script>';

        $website =  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>'. $mainframe->getHead().'

            <link rel="stylesheet" href="templates/'. 
$cur_template .'/css/template_css.css" type="text/css" />
            <link rel="stylesheet" href="'. VM_THEMEURL .'theme.css" 
type="text/css" />
            <link rel="shortcut icon" href="'. 
$mosConfig_live_site .'/images/favicon.ico" />
            <meta http-equiv="Content-Type" content="text/html; '. 
_ISO.'" />
            <meta name="robots" content="noindex, nofollow" />
        </head>
        <body class="contentpane">
            ' . $html .'
            ' . $footer .'
        </body>
    </html>';
    $website = str_replace ("resized%2F", "", $website);
    $website = str_replace ("&amp;amp;", "&amp;", $website);

           //die( htmlspecialchars($website));
        require_once( CLASSPATH."pdf/dompdf/dompdf_config.inc.php");
        $dompdf = new DOMPDF();

        $dompdf->load_html($website);
        $dompdf->render();

       $dompdf->stream("virtuetest.pdf", array('Attachment' => 0));

    }


}
?>

I don't see what is missing, although it seems to be a Ilink problem but I
don't see how to solve the problem.
Any ideas ?
Thanks
APB

Original issue: http://code.google.com/p/dompdf/issues/detail?id=28

Positioning Bug

I've got a PDF generating that uses two div tags that are both set to position: relative.

Inside those divs is another div that are both positioned absolutely. Normally the inner div would be positioned relative to the outer div, however both inner divs are positioned to the first relative-positioned div.

An example of this behavior can be seen here:
http://www.allnaturaltherapies.net/?gf_pdf=print-entry&fid=1&lid=1&notes=1&template=CFDMandate.php

The second 'Jake Jackson' should be positioned at the bottom of Page 2.

The HTML and CSS used to generate the PDF are as follows:

       <div id="cfd-page-1">
            <div class="content">Jake Jackson</div>
                <img width="690px" height="930px" src="/wp-content/plugins/gravity-forms-pdf-extended/images/CFD Mandate/CFDMandate-1.jpg" />       
       </div>

       <div id="cfd-page-2">
            <div id="box">Jake Jackson</div>
            <img width="690px" height="930px" src="/wp-content/plugins/gravity-forms-pdf-extended/images/CFD Mandate/CFDMandate-1.jpg" />
       </div>  

    #cfd-page-1 {
    position: relative; 
    }

    #cfd-page-2 {
    position: relative; 
    }

    #cfd-page-1 img, #cfd-page-2 img
    {
    position absolute;
    top: 0;
    left: 0;
    z-index: 50;
    }

    #cfd-page-1 .content {
        position: absolute;
        z-index: 51;
        left: 45%;
        bottom: 25pt;
    }

    #cfd-page-2 #box {
        position: absolute;
        z-index: 51;
        left: 80%;
        bottom: 25pt;
    }

Any help at resolving this would be greatly appreciated.

Thanks

command line mode CSS bug: background-image

Original author: [email protected] (July 21, 2009 20:41:09)

Hi! I hope this is the correct place to report this problem. I've searched the issues here and the
discussion group, but I haven't found this problem mentioned.
Thanks for an excellent PDF creator!
-Tim

What steps will reproduce the problem?

  1. In your css, explicitly set {background-image: none;} for any element
  2. Inside your php script, use the dompdf class directly. Specifically, the script will hang on
    $dompdf->render();
  3. call your php script from the command line:
    ~# php -f /path/to/script/myscript.php

What is the expected output? What do you see instead?
I expect no errors to output, and the dompdf object to successfully call the render() function.
Instead, the following Fatal Error occurs:

PHP Fatal error:  Uncaught exception 'DOMPDF_Exception' with message 'Unknown image type: 
/path/to/script/none.' in /path/to/script/dompdf/include/image_cache.cls.php:81
Stack trace:
#0 /path/to/script/dompdf/include/abstract_renderer.cls.php(105): 
Image_Cache::resolve_url('/path/to/script/', NULL, '', '')
#1 /path/to/script/dompdf/include/block_renderer.cls.php(62): Abstract_Renderer-
&gt;_background_image('/path/to/script/', 8, 8.04, 596, 100.464, Object(Style))
#2 /path/to/script/dompdf/include/renderer.cls.php(180): Block_Renderer-
&gt;render(Object(Block_Frame_Decorator))
#3 /path/to/script/dompdf/include/renderer.cls.php(91): Renderer-&gt;_render_frame('block', 
Object(Block_Frame_Decorator))
#4 /path/to/script/ in /path/to/script/dompdf/include/image_cache.cls.php on line 81

It looks to me as if dompdf is taking the 'none' after 'background-image:' literally, and trying to
find a local image called 'none'. Of course, there is no such image, and dompdf crashes.

What version of the product are you using? On what operating system?
Version: 0.5.1
OS: Mac OS X Server 10.4.11

Please provide any additional information below.
This error does no occur if the php script is available to the web and called via a browser, only
when called directly in command line mode.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=43

Ability to add a title, subject, etc

Original author: [email protected] (June 05, 2009 11:47:05)

What would you like dompdf to do:
Support the ability to add a Title, Subject, Keywords, etc and change
Creator, Producer, etc. TCPDF does this and there are what looks like
switches deep inside the DOMPDF framework for Title, Subject and so on but
I've no idea how to implement them.

Do you have an example:
Line 1119 - class.pdf.php - "case 'Title':"

Original issue: http://code.google.com/p/dompdf/issues/detail?id=23

does not work when an __autoload function already exists - please use standard class file names

Original author: [email protected] (May 23, 2009 16:57:17)

Hi,

i'm trying to use dompdf within an application that already relies on __autoload - actually it relies
on NaturePhp, which relies on __autoload() ;

I can't get it to work.

i've tried loading all the include files at start like:

if ( !function_exists(&quot;__autoload&quot;) ) {
  /**
   * Default __autoload() function
   *
   * @param string $class
   */
  function __autoload($class) {
    DOMPDF_autoload($class);
  }
} else {
    $all_classes=glob(DOMPDF_INC_DIR.&quot;/*&quot;);
    foreach($all_classes as $a_class){
        require_once($a_class);
    }
}

but this does not work as some classes extend others and it does not load in the correct
sequence.

For the current project i'll rename all the files in the includes folder to the standard $class .
".php" and put them on NaturePhp's library folder.

In the future you should either have an option not to depend on __autoload or rename the class
files to the php.net standard - so they can be easily exported to other __autoload dependent
platforms.

Best regards to all and keep up the good work ;)

Carlos Ouro

Original issue: http://code.google.com/p/dompdf/issues/detail?id=15

Image cache doesn't remove cached item from array

Original author: [email protected] (May 26, 2009 13:14:27)

What steps will reproduce the problem?

  1. Generate more than one pdf containing images within the same request

What is the expected output? What do you see instead?

I see errors complaining of trying to unlink files that don't exist (ie,
have already been unlinked from the first ImageCache::clear() call.

unlink(/tmp/dompdf_img_i0Dy1K) [function.unlink]: No such file or directory

What version of the product are you using? On what operating system?

0.5.1, on linux.

Please provide any additional information below.

ImageCache::clear() loops over the static $_cache array, but doesn't remove
them, so a second call to this function attempts to delete files that have
already been deleted when the first PDF was rendered.

Changing this (line 151 of include/image_cache.cls.php)

      foreach (self::$_cache as $entry) {
        list($file, $ext) = $entry;
        unlink($file);

To this:

      foreach (self::$_cache as $key => $entry) {
        list($file, $ext) = $entry;
        unlink($file);
        unset(self::$_cache[$key]);

Seems to work as expected.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=17

On intranet, implementing class redirects to www.aciworlwide.com

Original author: [email protected] (May 22, 2009 17:06:26)

What steps will reproduce the problem?
1.Create file with "Using the dompdf class directly" test code from
digitaljunkies/usage
2. Load file on intranet server from web browser

What is the expected output? What do you see instead?
Expected: stream a pdf file with example html.
Actual: redirected to
http://www.aciworldwide.com/directory_of_file/test_file_name.php

What version of the product are you using? On what operating system?
dompdf v.5.1
Server version: Microsoft Windows Server 2003 Standard Edition

Please provide any additional information below.
I see aciworldwide.com isn't hardcoded into the files anywhere and am
looking into the significance of that url and why it was chosen.

Using file_put_contents("newpdf.pdf",$dompdf->output()) has the same
redirection / unexpected output

It works fine on "regular" servers. The only environment it's not working
on for me happens to be an intranet. I understand not too many people may
be running this on an intranet, and that might not even be it, but any
workarounds you could suggest would help a lot.

Thanks!

Original issue: http://code.google.com/p/dompdf/issues/detail?id=13

PDFLIb borks on space in URI

Original author: [email protected] (July 23, 2009 11:06:53)

What steps will reproduce the problem?

  1. Create a HTML page with a link "<a href='http://www.example.org/file
    with spaces.html></a>' containing spaces in the URI
  2. use pdflib for rendering
  3. render it

What is the expected output? What do you see instead?
I expect to see a link to the uri in the pdf
instead i get a pdflib exception in the form
Exception type - PDFlibException
Exception message - Unknown option 'with'

What version of the product are you using? On what operating system?
dompdf 0.5.1/pecl_pdflib 2.1.7/CentOS 5.3

Please provide any additional information below.

This is not reproducible with CPDF.

I also have a fix:

line 721 of pdflib_adapter.cls.php
replace
$url = str_replace("=", "%3D", rawurldecode($url));
with
$url = str_replace(array("=", ' '), array("%3D", '%20'),
rawurldecode($url));

Original issue: http://code.google.com/p/dompdf/issues/detail?id=44

Notices errors

Original author: [email protected] (June 24, 2009 13:55:37)

What steps will reproduce the problem?

  1. use the dompdf.php?input_file=C%3A\tmp
    \domE0B.tmp&paper=letter&output_file=My Fancy PDF.pdf
  2. with any HTML file

What is the expected output? What do you see instead?
Notice: Undefined index: method__construct in C:\wamp\www\toto\libraries
\dompdf-0.5.1\lib\class.pdf.php on line 1213

Notice: Undefined index: methodget_base_path in C:\wamp\www\toto\libraries
\dompdf-0.5.1\lib\class.pdf.php on line 1213

Notice: Undefined index: methodget_host in C:\wamp\www\toto\libraries
\dompdf-0.5.1\lib\class.pdf.php on line 1213

...
You should add tests code in order to prevent all theses notice errors, OR
force a error_reporting(0); in the class.pdf.php

What version of the product are you using? On what operating system?
dompdf-0.5.1 / WAMP

Original issue: http://code.google.com/p/dompdf/issues/detail?id=31

Blank screen with large HTML

Original author: [email protected] (May 08, 2009 17:59:09)

Hi,
I have performance problems if trying to convert large html files (>500K
for ex.). Probably memory consumption is too high, but after submitting all
I got (after minute or two) is a blank screen. This happens both if the
file should be saved or outputted to the user. Are they any memory
limitations or a way to reduce memory load?

Product version - dompdf-0.5.1. Tested on linux servers.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=9

Per page background using either remote or local image files

Original author: [email protected] (June 24, 2009 18:04:08)

What would you like dompdf to do:
Take a PDF document, and configure a per page background. Something that
can be done on a per page basis, and is easy to configure, akin to a PHP
array or the likes. I can specify even/odd/specific pages to be targeted
for a background image, and send in a config array with the image location
and some internal placement parameters for it.

Do you have an example:
Well, not really, just a very specific functionality that I have needed for
some time for this stuff. Thanks for an excellent product!

Original issue: http://code.google.com/p/dompdf/issues/detail?id=33

Exception when rendering lists within table cell

Original author: [email protected] (July 29, 2009 21:42:47)

What steps will reproduce the problem?

  1. Add <table> <tr> <td> <ul> <li> this is a test </li> </ul> </td> </tr>
    </table>
  2. Attempt to render PDF
  3. Throws exception

What is the expected output? What do you see instead?
Bullet list rendered inside a table

What version of the product are you using? On what operating system?
Latest version as of 7/29/09

Please provide any additional information below.
Is it possible to render this without the order list via a simple patch?

Original issue: http://code.google.com/p/dompdf/issues/detail?id=45

<fieldset> Html Tag rendering

Original author: [email protected] (June 08, 2009 09:14:16)

I'm Using Dompdf 0.5.1 with Adobe Reader 9.1 as pdf reader

  • No additional css style in the page
  • Dynamic html created from mysql query

Seems like the <fieldset> tag isn't rendered properly
I'm going to attach the result of the below code:

require_once("dompdf_config.inc.php");
$html = "<fieldset><legend>Fieldset</legend></fieldset>";
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("Fieldset Test.pdf");

Original issue: http://code.google.com/p/dompdf/issues/detail?id=24

"Font contains a bad BBox" message with distributed font files (non-core)

Original author: eclecticgeek (May 21, 2009 16:40:04)

What steps will reproduce the problem?

  1. Enable one of the non-core fonts that are included in the distribution
    (e.g. Verdana) in dompdf_font_family_cache.
  2. Reference that font in an HTML document to be rendered by DOMPDF.
  3. Render the document and open in Acrobat.

The PDF renders, but the font is not embedded correctly and does not
render. Upon opening the document Acrobat pops up an alert that states:

The font "Verdana" contains a bad /BBox.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=12

Define a font fallback

Original author: eclecticgeek (June 03, 2009 15:46:52)

What would you like dompdf to do:
DOMPDF requires fonts referenced by a document that is rendered. When a
font has not been loaded DOMPDF will crash with an exception: Unable to
find a suitable font replacement for: 'font_name'

Ideally the user would have specified a fallback (sans, sans-serif, etc.)
for any font family definitions. In lieu of this, however, I think we
should have DOMPDF fall back to one of the core fonts.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=21

widths not calculated correctly for non-ANSI characters

Original author: [email protected] (June 24, 2009 09:26:03)

What steps will reproduce the problem?

  1. Execute attached file
  2. See the lines not right-aligned

What is the expected output? What do you see instead?
I would expect all the lines to be right-aligned. Instead german umlauts
seem to be ignored in width calculation (compare "fb" line), spanish ñ
causes a shift in the other direction, as if it had negative width.

What version of the product are you using? On what operating system?
Tried it with old 0.51, trunk and dompdf_trunk_with_helmut_mods on Windows
XP with PHP 5.2.6 with bundled cpdf.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=29

Background Image

Original author: [email protected] (July 15, 2009 03:06:54)

What steps will reproduce the problem?

  1. Take any div or table cell.
  2. put "background: url(http://mysite.com/images/image_here.gif)"
  3. render pdf and no image background.

What is the expected output? What do you see instead?
-suppose to be image will render too, but no image is attached. i have to
put it to the root directory and should be there for it to render the
background. like so: "background: url(image_here.gif)"

please help.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=40

Handling of TFOOT tag is incorrect

Original author: eclecticgeek (May 29, 2009 17:59:28)

What steps will reproduce the problem?

  1. Create an HTML document that contains a table with THEAD, TBODY, and
    TFOOT sections. The table should span two pages in the rendered PDF.
  2. Render the document with DOMPDF.

What is the expected output?

The PDF should contain a table that spans two pages. The THEAD and TFOOT
should bookend the table on each page on which it appears.

What do you see instead?

The THEAD renders as expected, but the TFOOT is rendered as if it were a
normal table row.

Additional information:

The TFOOT grouping should appear before the TBODY grouping in the HTML code
as per the W3C specification:
http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3

We may wish to consider allowing the TFOOT grouping to be placed at the end
of the table code since this is a likely scenario.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=18

CSS FLOAT property support

Original author: [email protected] (May 29, 2009 20:51:58)

What would you like dompdf to do:
Either have a more robust table-within-table functionality (also
div-within-table), or add float support.

Do you have an example:

<div style="width:65mm; height:40mm; float:left;">Block one</div>
<div style="width:65mm; height:40mm; float:left;">Block two</div>
<div style="width:65mm; height:40mm; float:left;">Block three</div>
<div style="width:65mm; height:40mm; float:left;">Block four</div>
<div style="width:65mm; height:40mm; float:left;">Block five</div>
<div style="width:65mm; height:40mm; float:left;">Block six</div>

Original issue: http://code.google.com/p/dompdf/issues/detail?id=19

Large texts in same page problem

When I have setted a page line break, into a div, and the div have a very large text ( maybe more than 1 page ). It will broken the PDF and causing fatal error, out of memory.

page numeber / total pages disappear with page-break:avoid

Original author: [email protected] (June 15, 2009 10:51:46)

What steps will reproduce the problem?

  1. create a div with style="page-break-inside:avoid;" near the end of the
    page
  2. insert a lot of text "lorem ipsum"
  3. output pdf: the number of the page vs total pages appear only in the
    last page and not in all pages as if i erease that style attribute.

What is the expected output? What do you see instead?
i expect to see page number on every page, i see it only on the last one
(in my case I had a lot of tables but not nested, on every page i had a
page-break-inside:avoid that works fine (not exactly fine, but I'll open
another issue for that) and i see page number only on the last page.) if i
erease page-break-inside:avoid condition I'll see tablese broken between
pages and page numenr vs total pages on every page as it was supposed to
be.

What version of the product are you using? On what operating system?
0.5.1 on ubuntu

Please provide any additional information below.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=25

images not working

This works
<div style="background-image: url('/images/obama-family.jpg');">

oddly, this does not
<img src="/images/obama-family.jpg" >

however, this does (but of course makes it more difficult to view the html)
<img src="/absolute/path/to/images/obama-family.jpg" >

have tried

$dompdf = new DOMPDF();
$dompdf->set_base_path('/absolute/path/to/');
etc;

without success

This is with CPDF or PDFLib. - 0.6.0 Beta 3

Unable to stream pdf: headers already sent

Original author: [email protected] (July 19, 2009 06:13:55)

What would you like dompdf to do: anyone can help me determine why i get
this error : " Unable to
stream pdf: headers already sent " ?? should i put the code at the
top for generating the pdf ??? anyone have an idea on this.. please
help me.. thanks a lot
Do you have an example:
Parse error: syntax error, unexpected T_DNUMBER in
/usr/local/www/hotspot/system/plugins/dompdf/lib/class.pdf.php(2219) :
eval()'d code on line 1
A PHP Error was encountered

Severity: Notice

Message: Undefined index: FontBBox

Filename: lib/class.pdf.php

Line Number: 3231

regrads
agung

Original issue: http://code.google.com/p/dompdf/issues/detail?id=42

Possible infinite loop

Original author: eclecticgeek (June 25, 2009 17:43:27)

What steps will reproduce the problem?

  1. Create an HTML document that uses inline-table styling on an element
    contained within another element (i.e. div within a div).
  2. Attempt to render the document.

What is the expected output? What do you see instead?
The document should be rendered as expected, or DOMPDF should error out in
a reasonable manner. On Windows, the apache child process handling the
request will die with a 3221225477 error (see the apache error.log). On
linux, the results appear to be similar, though I'm not sure if the apache
process is dying.

Prior to the end result a lot of the following duplicate errors are
recorded by PHP:
Undefined offset: 1 in dompdf\include\cellmap.cls.php on line 447

Possible relevant group posts:
http://groups.google.com/group/dompdf/browse_thread/thread/05c42dbd9fb5bc52
http://groups.google.com/group/dompdf/browse_thread/thread/edc2feff50725329

Original issue: http://code.google.com/p/dompdf/issues/detail?id=34

Localization setting

Original author: eclecticgeek (May 29, 2009 21:57:28)

What steps will reproduce the problem?

  1. Change localization, using setlocale(), within a PHP script that uses
    DOMPDF. Choose a localization, such as nl_NL/nld that uses commas instead
    of periods in decimal numbers.
  2. Load and render an HTML document.
  3. Open the resulting PDF with Acrobat.

What is the expected output? What do you see instead?
The PDF will be rendered, but the style of internal numbers used in object
positioning and formatting will be incorrect. Instead of period decimals
the numbers will be using commas. This will make kthe PDF document
unreadable by Acrobat and when opened it will return the following error
(Acrobat 8.1.5): "There was an error opening this document. There was a
problem reading this document (110)."

Source and resolution:
I believe this only affects CPDF (class.pdf.php). CPDF utilizes the
sprintf() function and formats numbers with the %f type specifier. This
type specifier is locale-aware. To correct the problem all calls to the
sprintf() function should be using %F (locale-unaware) instead of %f.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=20

text-transform

Original author: [email protected] (May 23, 2009 21:41:20)

include/text_render.cls.php, line 73:

$text = $frame->get_text();
// Handle text transform:
// http://www.w3.org/TR/CSS21/text.html#propdef-text-transform
switch ($style->text_transform) {   
    case "uppercase":
        //Puts all characters of each word in uppercase.
        $text=strtoupper($text);
        break;
    case "lowercase":
        //Puts all characters of each word in lowercase.
        $text=strtolower($text);
        break;
    case "capitalize&":
        //Puts the first character of each word in uppercase; other characters are unaffected.
        $text=ucwords($text);
        break;  
    }

Original issue: http://code.google.com/p/dompdf/issues/detail?id=16

Width property not working properly in 0.5.1

Original author: [email protected] (July 16, 2009 07:24:05)

What steps will reproduce the problem?

  1. Generate a PDF for this HTML:
<html>
<head>
<style>

/* Type some style rules here */

</style>
</head>

<body>
<table>
<tr>
<td style="width:8cm; border: 1px solid #CCC;">Izquierda</td>
<td style="width: 3cm;">Centro</td>
<td style="width:8cm; border: 1px solid #CCC;">Derecha</td></tr>
</table>
</body>
</html>

What is the expected output? What do you see instead?

I expected a 3 column layout, with a 8cm wide rectangle in the left and
right cells and a 3 cm. separation.

I see a 3 column layout, with rectangle in the left and right cells, but
not the right sizes, not 8cm for left and right cells and not a 3cm separation.

What version of the product are you using? On what operating system?

0.5.1 with the embedded PDF generator.

Please provide any additional information below.

If you try this HTML code in the generator present in the old project page
it renders well.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=41

PHP 5.3 compatibility - get/set_magic_quotes_runtime

Original author: [email protected] (July 07, 2009 16:41:29)

Hello,

get/set_magic_quotes_runtime as been deprecated in PHP 5.3 and
compatibility changes are required in lib/class.pdf.php .

If someone else has this problem a temporary workaround is to comment all
the lines that have either the set_magic_quotes_runtime or the
get_magic_quotes_runtime functions in lib/class.pdf.php (8 lines for set, 4
for get).

Best Regards,
Carlos Ouro

Original issue: http://code.google.com/p/dompdf/issues/detail?id=38

Internal Server Error on PHP 5.2.8

Original author: [email protected] (July 05, 2009 12:46:45)

An internal server error is produced when am trying to generate the PDF .
This error occurred when my host upgraded from php 5.2.6 to php 5.2.8

I tried searching the net for a solution , but it looks like it is a common
bug . Please help me finding a solution to this as it is an important
requirement in our web applications

Am using Linux shared host

Original issue: http://code.google.com/p/dompdf/issues/detail?id=37

Single quotes instead of double quotes

Original author: [email protected] (April 29, 2009 18:05:01)

Wrap your string in single quotes (’) instead of double quotes (”) is
faster because PHP searches for variables inside “…” and not in
‘…’, use this when you’re not using variables you need evaluating
in your string.
[http://spindrop.us/2007/03/03/php-double-versus-single-quotes/]

From: http://www.hm2k.com/posts/50-php-optimisation-tips-revisited

Original issue: http://code.google.com/p/dompdf/issues/detail?id=1

line break added on page-breake avoid

Original author: [email protected] (June 15, 2009 10:55:53)

What steps will reproduce the problem?

  1. write an html table near the end of the page formatted as:
    <table>
    <tr>
    <td>...</td>
    <tr>
    ...
    </table>
  2. set the syle="page break-inside:avoid" attribute
  3. render pdf

What is the expected output? What do you see instead?
in the new page you can see a lot of line break before the table, those
lines break disappear if you wrote in-line html:
<table><tr><td>...</td><tr>...</table> but this is very difficoult to do
and to update for big tables

What version of the product are you using? On what operating system?
0.5.1 ubuntu

Please provide any additional information below.

Original issue: http://code.google.com/p/dompdf/issues/detail?id=26

Local images need full path for rendering

Original author: [email protected] (July 14, 2009 11:29:05)

What steps will reproduce the problem?

  1. setup dompdf with CPDF
  2. setup html with an image tag using relative path
  3. try to generate a pdf document with dompdf

What is the expected output? What do you see instead?

The image should be displayed, instead i get a red X, if i set absolute
path for that image in img src attribute i can get the expected result.

What version of the product are you using? On what operating system?

SVN revision 70

Original issue: http://code.google.com/p/dompdf/issues/detail?id=39

Documentation fix

Original author: [email protected] (June 24, 2009 13:41:09)

What steps will reproduce the problem?

  1. open the README file
    2.
    3.

In the README documentation file, there is a mistake with the "tmpfile"
variable name... see below ($tmpfile != $tmp_file)

$tmpfile = tempnam("/tmp", "dompdf_");
file_put_contents($tmp_file, $smarty->fetch());

What version of the product are you using? On what operating system?
dompdf-0.5.1

Original issue: http://code.google.com/p/dompdf/issues/detail?id=30

split_text function (text_frame_decorator.cls.php) requires PHP > 5.2.6 for multibytes strings

Original author: [email protected] (June 29, 2009 12:12:26)

What steps will reproduce the problem?

  1. Use UTF-8 strings.
  2. When the line break offset is calculted to be after a word containing a
    UTF8 special (like "é"), the strip_text function does not separate the html
    tag correctly.

What is the expected output? What do you see instead?
The multibyte symbol is not displayed correctly and the rest of the line
(within the same html tag) is removed.

What version of the product are you using? On what operating system?
Works with PHP 5.2.9, doesn't with PHP <= 5.2.6

Please provide any additional information below.
see PHP Bug http://bugs.php.net/bug.php?id=46335

replace the strip_text function by this one :

function split_text($offset) {
    if ( $offset == 0 )
    return;

    //Bug for PHP <= 5.2.6  : http://bugs.php.net/bug.php?id=46335 
    //$split = $this->_frame->get_node()->splitText($offset);
    $node = $this->_frame->get_node();
    $clone = $node->cloneNode(true);

    //set new content of original $node
    $node->deleteData($offset, mb_strlen($node->textContent));

    //Add Node after with remaining text
    $clone->deleteData(0, $offset);
    $parent = $node->parentNode;
    $parent->appendChild($clone);

    $deco = $this->copy($clone);    

    $p = $this->get_parent();
    $p->insert_child_after($deco, $this, false);
    if ( $p instanceof Inline_Frame_Decorator )
      $p->split($deco);
}

Original issue: http://code.google.com/p/dompdf/issues/detail?id=35

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.