> Typically this is caused by a table flowing to a new page incorrectly. This
> problem was more prevalent on 0.5.2 than it is in 0.6.0. However, in
> testing your code the problem is still encountered with the latest code.
OK, thanks.
> On an initial look at your HTML I can say that one of the problems is that
> your defined page size in the document is larger than that available. For
> the sake of discussion you can assume that dompdf treats pixes and points
> as equivalent units of measurement. You're rendering to a letter-size
> document which has dimensions of 612x792. When including margins, padding,
> etc I believe your content is larger than this.
Ah, I didn't know this and it's probably the reason for all of the
errors I'm getting.
> Also, your CSS seems to be needlessly complex. There's a lot of
> declarations (such as position: relative) that don't seem to be necessary.
The HTML was autogenerated. I'm actually starting with a PDF,
converting it to HTML, allowing people to modify it and then
converting it back to PDF with dompdf. Unfortunately I don't have
good HTML to start with because all of the things I'm trying to
convert are already in PDF format.
Not that it's all that relevant to this post or my problems, but do
you know of any tools that convert between PDF and HTML and do it
well?
> You could simplify debugging a bit by removing unnecessary declarations and
> combining shared declarations into a common class used by multiple elements.
Right.
> Start with those things in mind and see where you get. If you need more
> direct help post back and I'll modify the simplified document to show you
> what I mean.
OK, thanks for that.
> Somewhere along the line something is happening that's resulting in an
> empty empty/null filename. We'll have to take a closer look to see if the
> problem is caused by something in the HTML or by the server configuration.
I took a bit of a closer look at this today, digging into the code.
Looking in the file dompdf/include/pdflib_adapter.cls.php I see that
the image type is being set on line 721: $img_type =
Image_Cache::detect_type($img_url);
which ultimately ends up calling this function in dompdf/include/
functions.inc.php:
function dompdf_getimagesize($filename) {
static $cache = array();
if ( isset($cache[$filename]) ) {
return $cache[$filename];
}
list($width, $height, $type) = getimagesize($filename);
if ( $width == null || $height == null ) {
$data = file_get_contents($filename, null, null, 0, 26);
if ( substr($data, 0, 2) === "BM" ) {
$meta = unpack('vtype/Vfilesize/Vreserved/Voffset/Vheadersize/
Vwidth/Vheight', $data);
$width = (int)$meta['width'];
$height = (int)$meta['height'];
$type = IMAGETYPE_BMP;
}
}
return $cache[$filename] = array($width, $height, $type);
}
Any idea why the $type is returning empty? Could it have something to
do with permissions on the /tmp directory?