I had a problem when I use images inside tables.
In some cases, blank pages appears when there's and
Image inside a table.
I've founnd a solution that works.
This problem is caused because when an image inside a
table has to be printed in a new page authomatically,
there's image() function from fpdf.php checks if the
image should be inserted in a new page, and in that
case adds a new page.
Then, also in _tableWrite() function from html2pdf it
is added a new page because this->y position is not
well updated.
I solved this doing the next change in html2pdf.php:
In OpenTag() function pasring <IMG> tag:
When says:
$sizesarray = $this->Image($srcpath, $this->GetX(),
$this->GetY(), $attr['WIDTH'],
$attr['HEIGHT'],'','',false);
$this->y = $bak_y;
$this->x = $bak_x;
I've changed to:
$sizesarray = $this->Image($srcpath, $this->GetX(),
$this->GetY(), $attr['WIDTH'],
$attr['HEIGHT'],'','',false);
if($sizesarray['X'] > 0 && $sizesarray['Y'] > 0){
$this->y = $sizesarray['Y'];
$this->x = $sizesarray['X'];
}
else{
$this->y = $bak_y;
$this->x = $bak_x;
}
I posted this If to possible errors inside Image()
function.
Now,In case of authomatic AddPage in Image(), y
position is well updated.
Also in fpdf.php file should be changed this function
Image:
When says:
if ( ($y + $h) > $this->fh )
{
$this->AddPage();
$y= $this->tMargin + 10; // +10 to avoid drawing too
close to border of page
$changedpage = true;
}
Should be:
if ( ($y + $h) > $this->fh )
{
$this->AddPage();
if($this->y <= $this->tMargin) $y= $this->tMargin +
10; // +10 to avoid drawing too close to border of page
else $y = $this->y;
$changedpage = true;
}
This change should be done because if you define a
Header() function, then the image is printed after the
header, not after tMargin+10 which could cause that the
Image is printed over the Header.
Congratulations for your work,
Regards,
Santi