undefined method DOMText::getAttribute()

3,118 views
Skip to first unread message

jamesmehorter

unread,
Jul 5, 2011, 5:01:48 PM7/5/11
to dompdf
Hey Everyone,

I just received this error while building a html -> pdf plugin for a
client for their WordPress site, using dompdf.

Fatal error: Call to undefined method DOMText::getAttribute() in /
Other Pica Shares/Websites/wcgh/wp-content/plugins/
WCGH_DoctorsToPDF_Plugin/dompdf_6.0/include/cellmap.cls.php on line
407

I receive the error in both dompdf 5.5 and 6.0 beta2. You can see the
html I'm feeding to dompdf here: http://d.pr/2a3l And I'm calling
dompdf like so:

//Create our pdf from the compiled html
require_once("dompdf_6.0/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($html_str);
$dompdf->render();
$pdf = $dompdf->output(); // store the entire PDF as a string in $pdf

...then I write $pdf out to a *.pdf file.


If I a bulk of that html it renders out just fine.. leads me to think
something in the html is causing this error? Any ideas would be much
appreciated. I also just noticed this error in my apache log, but was
going to debug that next... but maybe they are connected to my use of
png?

libpng warning: Interlace handling should be turned on when using
png_read_image

THANKS!

James

jamesmehorter

unread,
Jul 5, 2011, 5:09:22 PM7/5/11
to dompdf
Sorry... *If I remove a bulk of that html it renders fine*

Fabien Ménager

unread,
Jul 6, 2011, 7:54:35 AM7/6/11
to dom...@googlegroups.com
Hello, you have something like this at the ond of the doc:

        <tr>
          <td rowspan="8" valign="top">
            <a href="http://picadesign.ath.cx/wcgh/wp-content/uploads/2010/06/Chris-Walker.gif"><img class="alignnone size-full wp-image-724" title="Chris-Walker" src="http://picadesign.ath.cx/wcgh/wp-content/uploads/2010/06/Chris-Walker.gif" alt="" width="75" height="94" /></a>
          </td>
          <td>
            <strong>Office:</strong>
          </td>
        </tr>
        <p>
          <br class="spacer_" />
        </p>
        <tr> ....

Look at the <p> that is between two table rows. We'll try to be more defensive on such mistakes.

jamesmehorter

unread,
Jul 6, 2011, 10:03:59 AM7/6/11
to dompdf
Hey Fabian,

You're absolutely correct!! I've gone in and cleaned up the html in
that section and the pdf generates just fine now! If I run into any
other glitches like this I will validate my html before posting here,
seems like that should correct most issues. Thanks for taking your
time to look at my code!!

James

On Jul 6, 7:54 am, Fabien Ménager <fabien.mena...@gmail.com> wrote:
> Hello, you have something like this at the ond of the doc:
>
>         <tr>
>           <td rowspan="8" valign="top">
>             <a
> href="http://picadesign.ath.cx/wcgh/wp-content/uploads/2010/05/Deb-Czuchra-..."></a>
>             <a
> href="http://picadesign.ath.cx/wcgh/wp-content/uploads/2010/06/Chris-Walker..."><img
> class="alignnone size-full wp-image-724" title="Chris-Walker"
> src="http://picadesign.ath.cx/wcgh/wp-content/uploads/2010/06/Chris-Walker..."
Reply all
Reply to author
Forward
0 new messages