Jeckky / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

DOMDocument::loadHTML() [domdocument.loadhtml]: error parsing attribute name in Entity, line xxx #481

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Create a simple styled form that is supposed to export the info filled by the 
user to a php template that will be rendered to PDF and mailed.
Since i won't keep the page i am working it too much time online, you can find 
the example i am using for my work bellow 
While the smaller sample in the above mentioned example works as a charm, a 
longer form (lets say above 70 fields (mine has around 100 text fields) ends in 
a blank browser screen. Enabling the DOMPDF 
warnings will cause the browser displaying the following (please ignore the ..."

"...
DOMDocument::loadHTML() [domdocument.loadhtml]: error parsing attribute name in 
Entity, line: 433 DOMDocument::loadHTML() [domdocument.loadhtml]: Tag : invalid 
in Entity, line: 433 DOMDocument::loadHTML() [domdocument.loadhtml]: error 
parsing attribute name in Entity, line: 437 DOMDocument::loadHTML() 
[domdocument.loadhtml]: Tag : invalid in Entity, line: 437
..."

An online example available here:

http://coreyworrell.com/blog/article/php-html-email-pdf-attachment

What is the expected output? What do you see instead?

to work...:)

What version of dompdf are you using? What version of PHP? On what
operating system?

PHP Version 5.2.17
DOMPDF 0.6.0 beta 3

Please provide the HTML source code you want to convert, or any additional 
information.

Aside the files in the enclosed archive (not containing dompdf and swiftmail ) 
please find the bellow info regarding the environment this application is 
supposed to run on. 

*************from what dompdf setup.php displays ***************
DOMDocument extension   Yes  20031129
PCRE    Yes  Yes
Zlib    Yes  1.1
MBString extension  Yes  Yes
GD  Yes  Yes
APC For better performances 
No. Recommended for better performances
GMagick or IMagick  Better with transparent PNG images  
No. Recommended for better performances

The CPANEL displays the following:

main    asp_tags        Off
main    file_uploads        On
main    include_path        .:/usr/lib/php:/usr/local/lib/php
main    max_execution_time      30
main    max_input_time      30
main    memory_limit        48M
main    register_globals        Off
main    safe_mode       Off
main    session.save_path       /tmp
main    upload_max_filesize     50M
main    zend_optimizer.version      3.3.0

Note: I am using a shared location so basically i can't do anything with the 
server's settings.

Thank you in advance.
n.

Original issue reported on code.google.com by ara...@gmail.com on 11 May 2012 at 10:59

Attachments:

GoogleCodeExporter commented 8 years ago
The fact that the errors you're seeing are coming from DOMDocument indicates 
that there are some problems with your document structure. I was able to 
identify three structural issues that, after fixing, allowed me to render the 
document. In pdf.php remove the unnecessary opening TD tag on line 14, and 
remove or encode the < character in the text of the table cells on lines 433 & 
437.

Pay attention to your HTML syntax. Seemingly innocuous issues in document 
structure that a web browser can handle can cause DOMDocument to give up. When 
this happens you should run your document through a validator to identify any 
problems: http://validator.w3.org

You can avoid this kind of error in the future by enabling the HTML5 document 
parser (when using dompdf 0.6.0 beta 3 or greater). Your document does not have 
to be HTML5 in order to take advantage of the HTML5 parser. The benefit of 
enabling the library is that it is able to correct a number of structural 
errors in HTML document. (I was initially unable to reproduce the problem 
because I had this library enabled on my server).

Original comment by eclecticgeek on 13 May 2012 at 4:23

GoogleCodeExporter commented 8 years ago
Hello,

Many thanks for feedback. I'll check this asap and see what happens.

P.S. maybe i missed to specify that i am a big noob in this branch of 
engineering.

A fine day and week ahead,
n.

Original comment by ara...@gmail.com on 13 May 2012 at 9:16

GoogleCodeExporter commented 8 years ago
ok..later edit.

I confirm the error. Many thanks for support.
n.

Original comment by ara...@gmail.com on 13 May 2012 at 11:06

GoogleCodeExporter commented 8 years ago
Glad this resolved the issue. Feel free to post here with bugs, or join us on 
the support forum for anything else: http://groups.google.com/group/dompdf

Original comment by eclecticgeek on 15 May 2012 at 1:39

GoogleCodeExporter commented 8 years ago

Original comment by eclecticgeek on 30 May 2013 at 5:16