dompdf help request

562 views
Skip to first unread message

TimA1116

unread,
Jun 23, 2009, 1:26:34 AM6/23/09
to dompdf
All,

I'm attempting to use dompdf to generate a pdf from multi-paged and
multi-table within table html code. The html is generated dynamically
and captured in the variable $html. I attempt to render $html like
so:

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("application_$app_date.pdf");

and I get a blank page, with no save as window - nothing. The dompdf
files are a little off the normal path as this is my include file:

include_once('resume_uploads/includes/dompdf/dompdf_config.inc.php';

I don't know what else to do to make dompdf work. Ideally, I would
like to simply generate the PDF and save it to the server for later
use.

Your help is appreciated!

Thanks,
Tim Allums

Oliver Eikel

unread,
Jun 23, 2009, 9:35:17 AM6/23/09
to dom...@googlegroups.com
Dear all,

I found out, that dompdf only supprts very basic html/css, right.

Clean the source from every "advanced css/html/javascript"

E.g. in my case dompdf ignored my <th>. Replaced by <tr> it's fine.
Every javascript, divs and so on , out.
Simple color, font-family,border, background color width,height. Stuff
like that is fine.

My idea is to replace your.css with pdf.css.
Best
Ollie

2009/6/23 TimA1116 <tal...@gmail.com>:
--
Frisch überarbeitet:
_______________
www.olivereikel.de

BrianS

unread,
Jun 23, 2009, 11:37:26 AM6/23/09
to dompdf
On Jun 23, 9:35 am, Oliver Eikel <ei...@olivereikel.de> wrote:
> Dear all,
>
> I found out, that dompdf only supprts very basic html/css, right.
>
> Clean the source from every "advanced css/html/javascript"

I don't know that I'd say "very basic" but DOMPDF does have some
limitations as to what CSS it supports. Check out the CSS
compatibility table <http://code.google.com/p/dompdf/wiki/
CSSCompatibility> to see what is and is not supported.

And just to note, javascript is not supported at all. So if your page
relies on JS to display correctly don't expect DOMPDF to render it.

> E.g. in my case dompdf ignored my <th>. Replaced by <tr> it's fine.

DOMPDF should be able to handle TH tags, though I have noticed some
problems with the layout of the cells in a simple table. We'll have to
look into this more.

-b

BrianS

unread,
Jun 23, 2009, 11:40:47 AM6/23/09
to dompdf
You're not getting any output at all, so most likely PHP is erroring
out before the script is done executing. You could be running up
against script execution or memory usage limits. Or there could be
some other problem. Check out your PHP error.log to see what caused
the script to halt execution.

I will note that the current release of DOMPDF does not do well with
complex structures like nested tables. I believe the upcoming release
will do better.

Oliver Eikel

unread,
Jun 23, 2009, 1:16:08 PM6/23/09
to dom...@googlegroups.com
Hey,

I didn't want to offend anybody! All I want, is to share experiences I made.

Best
Oliver

2009/6/23 BrianS <eclect...@gmail.com>

Tim Allums

unread,
Jun 23, 2009, 7:39:33 PM6/23/09
to dom...@googlegroups.com
All,

Thanks so much for your input.  I've stripped out any unnecessary html tags / css / js / etc., and the following is what shows up in my server's error_log:

PHP Strict Standards: Only variables should be assigned by reference in one of my db connection files
PHP Notice: Undefined offset: 3 in /var/www/vhosts/some.url.com/httpdocs/somedir/somedir2/includes/dompdf/include/cellmap.cls.php on line 559
PHP Fatal error: Call to a member function get_id() on a non-object in /var/www/vhosts/some.url.com/httpdocs/somedir/somedir2/includes/dompdf/include/cellmap.cls.php on line 560

The first error appeared after I started using dompdf.  Not sure if it is significant. How do I fix the last two above errors?

Thanks again!

Tim Allums

BrianS

unread,
Jun 23, 2009, 11:33:36 PM6/23/09
to dompdf
No offense taken, just trying to clarify the limitations. Always glad
to have others report on their experience with DOMPDF :)
-b

BrianS

unread,
Jun 23, 2009, 11:49:49 PM6/23/09
to dompdf
On Jun 23, 7:39 pm, Tim Allums <tall...@gmail.com> wrote:
> All,
>
> Thanks so much for your input.  I've stripped out any unnecessary html
> tags / css / js / etc., and the following is what shows up in my
> server's error_log:
>
> PHP Strict Standards: Only variables should be assigned by reference in
> one of my db connection files
> The first error appeared after I started using dompdf. Not sure if it
> is significant.

I'm not sure why DOMPDF would cause an error here. It could be
related, but I don't think so. Still, it's something you should
investigate further, even if it doesn't have any apparent affect on
your output.

> PHP Notice: Undefined offset: 3 in
> /var/www/vhosts/some.url.com/httpdocs/somedir/somedir2/includes/dompdf/incl ude/cellmap.cls.php
> on line 559
> PHP Fatal error: Call to a member function get_id() on a non-object in
> /var/www/vhosts/some.url.com/httpdocs/somedir/somedir2/includes/dompdf/incl ude/cellmap.cls.php
> on line 560
>
> How do I fix the last two above errors?

It looks like DOMPDF is having trouble with your tables. I suspect is
is trying to move a table row from one page to the next after running
out of space on a page, and failing in a bad way. Do you have some
sample code you can post?

Jacob

unread,
Jun 25, 2009, 12:26:05 PM6/25/09
to dompdf
I was fighting with an error that looked exactly like this just about
a week ago. I think what I would up doing was making sure that all of
my rows had the same number of cells in them. Once I did this, I
believe the errors went away. You might want to try that.

On Jun 23, 7:39 pm, Tim Allums <tall...@gmail.com> wrote:

Josh

unread,
Jul 13, 2009, 6:21:44 PM7/13/09
to dompdf
I am getting the same error. I have a large table with some CSS but
all JavaScript has been removed. This is what I see. If some of my
HTML would be helpful, just let me know and I can post it.

Notice: Undefined offset: 3 in /home/josh/workspace/soho/includes/
dompdf/include/cellmap.cls.php on line 559

Fatal error: Call to a member function get_id() on a non-object in /
home/josh/workspace/soho/includes/dompdf/include/cellmap.cls.php on
line 560

On Jun 25, 10:26 am, Jacob <jrsnyd...@gmail.com> wrote:
> I was fighting with an error that looked exactly like this just about
> a week ago.  I think what I would up doing was making sure that all of
> my rows had the same number of cells in them.  Once I did this, I
> believe the errors went away.  You might want to try that.
>
> On Jun 23, 7:39 pm, Tim Allums <tall...@gmail.com> wrote:
>
> > All,
>
> > Thanks so much for your input.  I've stripped out any unnecessary html
> > tags / css / js / etc., and the following is what shows up in my
> > server's error_log:
>
> > PHP Strict Standards: Only variables should be assigned by reference in
> > one of my db connection files
> > PHP Notice:Undefinedoffset: 3 in

BrianS

unread,
Jul 22, 2009, 12:56:06 PM7/22/09
to dompdf
On Jul 13, 6:21 pm, Josh <josh.co...@gmail.com> wrote:
> I am getting the same error. I have a large table with some CSS but
> all JavaScript has been removed. This is what I see. If some of my
> HTML would be helpful, just let me know and I can post it.
>
> Notice: Undefined offset: 3 in /home/josh/workspace/soho/includes/
> dompdf/include/cellmap.cls.php on line 559
>
> Fatal error: Call to a member function get_id() on a non-object in /
> home/josh/workspace/soho/includes/dompdf/include/cellmap.cls.php on
> line 560

Seeing your HTML would be helpful. I have an idea about what's
happening but would like to see exactly what your passing to DOMPDF.
Reply all
Reply to author
Forward
0 new messages