dompdf adds inner borders to the html table

3,014 views
Skip to first unread message

Patrick

unread,
Jul 18, 2010, 1:31:15 PM7/18/10
to dompdf
hi,

I'm having some issues in displaying a table with dompdf:
http://dl.dropbox.com/u/72686/domPdfTable.png

The table contains all borders I don't have in my original table in
html: http://dl.dropbox.com/u/72686/htmltable.png

how can I remove these borders from the final pdf document ?

thanks

BrianS

unread,
Jul 18, 2010, 4:48:06 PM7/18/10
to dompdf
Try the following in your stylesheet:

table { border-collapse: collapse; }

Patrick Diviacco

unread,
Jul 18, 2010, 4:54:40 PM7/18/10
to dom...@googlegroups.com
almost fixed!... Still double borders in some rows...

thanks

--
You received this message because you are subscribed to the Google Groups "dompdf" group.
To post to this group, send email to dom...@googlegroups.com.
To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dompdf?hl=en.


BrianS

unread,
Jul 18, 2010, 5:16:34 PM7/18/10
to dompdf
Are you using 0.5.1? It could be a bad cascade of the border property.
It looks like 0.6.1 renders better.

Also, beware of this bug: http://code.google.com/p/dompdf/issues/detail?id=70
The issue is addressed in 0.6.1, but it looks like another bug may be
affecting you (something new we'll have to investigate). If you want
to insert an empty row make sure you include the empty TDs as well.


On Jul 18, 4:54 pm, Patrick Diviacco <patrick.divia...@gmail.com>
wrote:
> almost fixed!... Still double borders in some rows...http://dl.dropbox.com/u/72686/collapsed.png
>
> This is the html code:http://dl.dropbox.com/u/72686/print.html
> thanks
>
> On 18 July 2010 22:48, BrianS <eclecticg...@gmail.com> wrote:
>
>
>
> > Try the following in your stylesheet:
>
> >  table { border-collapse: collapse; }
>
> > On Jul 18, 1:31 pm, Patrick <patrick.divia...@gmail.com> wrote:
> > > hi,
>
> > > I'm having some issues in displaying a table with dompdf:
> >http://dl.dropbox.com/u/72686/domPdfTable.png
>
> > > The table contains all borders I don't have in my original table in
> > > html:http://dl.dropbox.com/u/72686/htmltable.png
>
> > > how can I remove these borders from the final pdf document ?
>
> > > thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "dompdf" group.
> > To post to this group, send email to dom...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > dompdf+un...@googlegroups.com<dompdf%2Bunsu...@googlegroups.com>
> > .

Patrick

unread,
Jul 20, 2010, 10:47:11 AM7/20/10
to dompdf
yeah I'm using 0.5.1. However I have updated ti to 0.6.1 to see if it
works but it stops to work. This is the page I get:
http://dl.dropbox.com/u/72686/dompdf06bug.html

And this is the code I use:

require_once("dompdf/dompdf_config.inc.php");

//these are drupal functions to get a html string.
$invoice = uc_order_load_invoice(uc_order_load(54));

$dompdf = new DOMPDF();
$dompdf->load_html($invoice);

//$dompdf->load_html_file('invoices/' . $file);
$dompdf->render();
$dompdf->stream("sample.pdf");

thanks

Patrick

unread,
Jul 20, 2010, 11:11:20 AM7/20/10
to dompdf
I've also added meta tags now...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<table ...

..
</body>
</html>

still same issues, thanks

BrianS

unread,
Jul 20, 2010, 2:27:56 PM7/20/10
to dompdf
I'm not sure what's going on here. It looks like you're getting source
code returned, which doesn't make much sense to me ... and in
particular the specific code that is returned. We have noticed
occasional problems on upload. Can you try downloading the latest code
and uploading it to your server one more time?

BrianS

unread,
Jul 20, 2010, 2:30:55 PM7/20/10
to dompdf
Your document encoding may not actually be UTF-8. Some editors don't
handle UTF-8, others only use it if you change the program settings.
Try specifying iso-8859-1 and see what happens. You could also try the
entity (&pound;).

Patrick Diviacco

unread,
Jul 22, 2010, 6:31:30 AM7/22/10
to dom...@googlegroups.com
I've solved all issues uploading the last version of the dompdf!
Fixed:
- unwanted fonts symbols
- table borders
- images

However, it introduced another bug: some text is wrongly positioned.

Please see the attachment 

To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.
sample-2.pdf

Patrick

unread,
Jul 22, 2010, 6:32:55 AM7/22/10
to dompdf
This is the HTML code: http://dl.dropbox.com/u/72686/print.html


On Jul 22, 12:31 pm, Patrick Diviacco <patrick.divia...@gmail.com>
wrote:
> I've solved all issues uploading the last version of the dompdf!
> Fixed:
> - unwanted fonts symbols
> - table borders
> - images
>
> However, it introduced another bug: some text is wrongly positioned.
>
> Please see the attachment
>
> > <dompdf%2Bunsu...@googlegroups.com<dompdf%252Bunsubscribe@googlegroups. com>
>
> > > > > > > .
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/dompdf?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "dompdf" group.
> > To post to this group, send email to dom...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > dompdf+un...@googlegroups.com<dompdf%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/dompdf?hl=en.
>
>
>
>  sample-2.pdf
> 24KViewDownload

BrianS

unread,
Jul 22, 2010, 1:46:36 PM7/22/10
to dompdf
A few things of note:

1) Your document includes the following invalid code (doesn't really
affect rendering):

</span">

2) Your document includes the following code which is breaking your
table:

<tr style="height: 60px;"></tr>

DOMPDF isn't as good as your typical browser at "filling in the
blanks" ... especially where tables are concerned. Make sure you
specify the full table structure. Even the following would address the
issue sufficiently:

<tr style="height: 60px;"><td>&nbsp;</td></tr>

Note that you do have to add a non-breaking space. There is a bug with
empty table cells that will produce the same result as you are
currently seeing.

You may have to tinker with the formatting a little to get things just
right.

Patrick Diviacco

unread,
Jul 23, 2010, 3:24:27 AM7/23/10
to dom...@googlegroups.com
I've fixed what you say, still the text is not correctly positioned. See screenshots before...

This is the updated html code: http://dl.dropbox.com/u/72686/template.html

To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.

Patrick Diviacco

unread,
Jul 23, 2010, 4:02:06 AM7/23/10
to dom...@googlegroups.com
Update: it seems that dompdf really doesn't like "textalign:right" property in tables. I've removed it and the layout improved.

Still the bottom block of my table is moved on the top.

thanks

Patrick Diviacco

unread,
Jul 23, 2010, 4:09:19 AM7/23/10
to dom...@googlegroups.com
ok, I found out, this was the line creating the issue: <tr><td colspan="2">&nbsp;</td></tr>

I've created this line because I wanted to add some vertical space between 2 rows. Do you know how can I do it in a compatible way with dompdf ?

thanks

BrianS

unread,
Jul 23, 2010, 12:34:06 PM7/23/10
to dompdf
When you said you updated to the latest version do you mean the 0.6.0
beta 1 or the latest development code? There is a bug related to non-
breaking spaces (they are stripped out in addition to normal spaces)
which will be addressed in an upcoming beta release. You can get the
most up-to-date code base here:
http://eclecticgeek.com/dompdf/

Otherwise, add the following style declaration to your document:

td {min-height: 1em;}

DOMPDF has a bug related to empty table cells with no declared height.


On Jul 23, 4:09 am, Patrick Diviacco <patrick.divia...@gmail.com>
wrote:
> ok, I found out, this was the line creating the issue: <tr><td
> colspan="2">&nbsp;</td></tr>
>
> I've created this line because I wanted to add some vertical space between 2
> rows. Do you know how can I do it in a compatible way with dompdf ?
>
> thanks
>
> On 23 July 2010 10:02, Patrick Diviacco <patrick.divia...@gmail.com> wrote:
>
> > Update: it seems that dompdf really doesn't like "textalign:right" property
> > in tables. I've removed it and the layout improved.
>
> > Still the bottom block of my table is moved on the top.
> > HTML:http://dl.dropbox.com/u/72686/template.html
> > PDF:http://dl.dropbox.com/u/72686/sample.pdf
>
> > thanks
>
> > On 23 July 2010 09:24, Patrick Diviacco <patrick.divia...@gmail.com>wrote:
>
> >> I've fixed what you say, still the text is not correctly positioned. See
> >> screenshots before...
>
> >> This is the updated html code:
> >>http://dl.dropbox.com/u/72686/template.html
>
> >>> <dompdf%2Bunsu...@googlegroups.com<dompdf%252Buns...@googlegroups.com>
>
> >>> > > > <dompdf%2Bunsu...@googlegroups.com<dompdf%252Buns...@googlegroups.com>
> >>> <dompdf%252Bunsubscribe@googlegroups. com>
>
> >>> > > > > > > > > .
> >>> > > > > > > > > For more options, visit this group at
> >>> > > > > > > > >http://groups.google.com/group/dompdf?hl=en.
>
> >>> > > > --
> >>> > > > You received this message because you are subscribed to the Google
> >>> Groups
> >>> > > > "dompdf" group.
> >>> > > > To post to this group, send email to dom...@googlegroups.com.
> >>> > > > To unsubscribe from this group, send email to
> >>> > > > dompdf+un...@googlegroups.com<dompdf%2Bunsu...@googlegroups.com>
> >>> <dompdf%2Bunsu...@googlegroups.com<dompdf%252Buns...@googlegroups.com>
Reply all
Reply to author
Forward
0 new messages