1

I am working with mssql and exporting the rows into an HTML table to then be converted to pdf, and emailed.
I first thought that it was mssql timeout, so I increased my server php settings. But I am not sure where to go to trouble shoot from there....
I need some help trying to find out why when I create a table, with a whole lot of rows I get this error:

ERROR n°3
File : D:\Shares\IntraNet\html2pdf\parsingHTML.class.php
Line : 125

HTML code invalid, a tag is closed too many times: <tr>

It prints fine into a browser with no errors. And on that line there are the correct number of opens and closes.

Any help on this would be great.

Thanks,

pdfnovice

2

try to validate your html code with the add-on "Html Validator" under Firefox, you will see some bugs tongue
Ancien pseudo : lolo

3

yes, "displays fine" is not an argument since firefox&al are highly tolerant to html errors. But with html2pdf, html files are machine read (and not browser read) so the tag nesting errors are not acceptablesmile

4

I have gone through it with an HTML validation, and the only errors that are coming up are the <page> & <page_header> tags that are required by the pdf converter its self.

Any ideas? Here is the output from the validation.

HTML Validator result
----------------------
http://intranet/html2pdf/reportsvr/report/OPACT_REPORT.php

line 17 column 1 - Error: <page> is not recognized!
line 17 column 1 - Warning: discarding unexpected <page>
line 18 column 2 - Error: <page_header> is not recognized!
line 18 column 2 - Warning: discarding unexpected <page_header>
line 26 column 10 - Warning: discarding unexpected </page_header>
line 76 column 1 - Warning: discarding unexpected </page>
Info: Document content looks like XHTML 1.0 Transitional
2 errors / 5 warnings


If there are nested tags, I don't see them. Just a whole lot of <tr>'s because I have quite a few tables.
pdfnovice

5

can you put your html code here ?
Ancien pseudo : lolo

6

I use the header as a generic report label, run the query, and it like as soon as it hits a majic number of tables I get an error, and I can't seem to find out why. This isn't the only report I get it in. But if I take and run only the first of the two tables below, there are not errors. I run just the second table, no errors. I run them in same report. Errors.

Any help would be great.


--------------------------------------------
<style type="text/css">
table.out {
border: 1px solid #555555;
}
table.out th {
border: 1px solid #555555;
}
table.out td {
border: 1px solid #555555;
}
</style>

<page>
<page_header>
<table style="width: 100%; border: solid 1px black;">
<tr>
<td style="text-align: left; width: 33%">Name1</td>
<td style="text-align: center; width: 34%">Sql Transaction Report By User</td>
<td style="text-align: right; width: 33%">Run Date: 2010-01-11</td>
</tr>
</table>
</page_header>


<table cellspacing="0" class="out" width="1825">
<tr><td><b>Day</b></td><td><b>Hour</b></td><td><b>Number Of Actions</b></td></tr>
<tr><td> 01/09/10 </td><td> 18:00-19:00 </td><td> 120 </td></tr>

<tr><td> 01/09/10 </td><td> 19:00-20:00 </td><td> 417 </td></tr>
<tr><td> 01/09/10 </td><td> 20:00-21:00 </td><td> 281 </td></tr>
<tr><td> 01/09/10 </td><td> 21:00-22:00 </td><td> 386 </td></tr>

<tr><td> 01/09/10 </td><td> 22:00-23:00 </td><td> 355 </td></tr>
<tr><td> 01/09/10 </td><td> 23:00-00:00 </td><td> 402 </td></tr>
<tr><td> 01/10/10 </td><td> 00:00-01:00 </td><td> 327 </td></tr>

<tr><td> 01/10/10 </td><td> 01:00-02:00 </td><td> 450 </td></tr>
<tr><td> 01/10/10 </td><td> 02:00-03:00 </td><td> 289 </td></tr>
<tr><td> 01/10/10 </td><td> 03:00-04:00 </td><td> 271 </td></tr>

<tr><td> 01/10/10 </td><td> 04:00-05:00 </td><td> 269 </td></tr>
<tr><td> 01/10/10 </td><td> 05:00-06:00 </td><td> 264 </td></tr>
<tr><td> 01/10/10 </td><td> 06:00-07:00 </td><td> 242 </td></tr>

<tr><td> 01/10/10 </td><td> 07:00-08:00 </td><td> 361 </td></tr>
<tr><td> 01/10/10 </td><td> 08:00-09:00 </td><td> 564 </td></tr>
<tr><td> 01/10/10 </td><td> 09:00-10:00 </td><td> 495 </td></tr>

<tr><td> 01/10/10 </td><td> 10:00-11:00 </td><td> 557 </td></tr>
<tr><td> 01/10/10 </td><td> 11:00-12:00 </td><td> 294 </td></tr>
<tr><td> 01/10/10 </td><td> 12:00-13:00 </td><td> 344 </td></tr>

<tr><td> 01/10/10 </td><td> 13:00-14:00 </td><td> 380 </td></tr>
<tr><td> 01/10/10 </td><td> 14:00-15:00 </td><td> 393 </td></tr>
<tr><td> 01/10/10 </td><td> 15:00-16:00 </td><td> 414 </td></tr>

<tr><td> 01/10/10 </td><td> 16:00-17:00 </td><td> 340 </td></tr>
<tr><td> 01/10/10 </td><td> 17:00-18:00 </td><td> 280 </td></tr>
<tr><td> 01/10/10 </td><td> 18:00-19:00 </td><td> 405 </td></tr>

<tr><td> 01/10/10 </td><td> 19:00-20:00 </td><td> 365 </td></tr>
<tr><td> 01/10/10 </td><td> 20:00-21:00 </td><td> 411 </td></tr>
<tr><td> 01/10/10 </td><td> 21:00-22:00 </td><td> 362 </td></tr>

<tr><td> 01/10/10 </td><td> 22:00-23:00 </td><td> 331 </td></tr>
<tr><td> 01/10/10 </td><td> 23:00-00:00 </td><td> 332 </td></tr>
<tr><td> 01/11/10 </td><td> 00:00-01:00 </td><td> 320 </td></tr>

<tr><td> 01/11/10 </td><td> 01:00-02:00 </td><td> 292 </td></tr>
<tr><td> 01/11/10 </td><td> 02:00-03:00 </td><td> 118 </td></tr>
</table>

<p><h2> Swing Shift </h2></p>

<table cellspacing='0' class='out' width='1825'><tr><td><b>User</b></td><td><b>1500-1600</b></td><td><b>1600-1700</b></td><td><b>1700-1800</b></td><td><b>1800-1900</b></td><td><b>1900-2000</b></td><td><b>2000-2100</b></td><td><b>2100-2200</b></td><td><b>2200-2300</b></td></tr>
<tr><td> user1 </td><td> 2 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td></tr>

<tr><td> user2 </td><td> 71 </td><td> 73 </td><td> 57 </td><td> 132 </td><td> 83 </td><td> 104 </td><td> 69 </td><td> 4 </td></tr>

<tr><td> user3 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 7 </td><td> 0 </td><td> 17 </td><td> 4 </td></tr>

<tr><td> user4 </td><td> 87 </td><td> 49 </td><td> 44 </td><td> 65 </td><td> 94 </td><td> 132 </td><td> 97 </td><td> 130 </td></tr>

<tr><td> user5 </td><td> 95 </td><td> 102 </td><td> 50 </td><td> 106 </td><td> 154 </td><td> 186 </td><td> 218 </td><td> 136 </td></tr>

<tr><td> user6 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 9 </td></tr>

<tr><td> user7 </td><td> 71 </td><td> 46 </td><td> 36 </td><td> 52 </td><td> 94 </td><td> 76 </td><td> 76 </td><td> 134 </td></tr>

<tr><td> user8 </td><td> 92 </td><td> 72 </td><td> 95 </td><td> 141 </td><td> 214 </td><td> 128 </td><td> 168 </td><td> 166 </td></tr>

<tr><td> user9 </td><td> 0 </td><td> 0 </td><td> 0 </td><td> 33 </td><td> 138 </td><td> 68 </td><td> 106 </td><td> 108 </td></tr>

</table>
</page>
pdfnovice

7

i have test with your html code : no error cheeky

what is your version of HTML2PDF ?
Ancien pseudo : lolo

8

This:
*******************************
* HTML2PDF v3.26 - 2009-11-16 *
*******************************

What version are you using?
pdfnovice

9

the "under developpement" version smile

but you can try with the 3.27 (from today wink)
Ancien pseudo : lolo

10

I don't think it has to do with version. I think that there may be a timeout in processing the code. I am processing and totaling, and joining approx 40,000 rows. It takes 7 seconds to process the first and second query total.

What I believe is happening is that the pdf process function may be cutting off the full parse of the PHP at the point where it fails, saying there there is not TR close because in uploading of the table possibly did not load into the variable.

Here is the main processing page via php:

include(dirname(__FILE__).'/report/opact_report.php');
$content = ob_get_clean();
// conversion HTML => PDF
require_once(dirname(__FILE__).'/../html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','en');
$html2pdf->setDefaultFont('Arial');
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
$content_PDF = $html2pdf->Output('', true);

//Email Report
$filename = "OpAction";
$filename = $filename . '_' . date("m-d-y_Hi", time()) . '.pdf';
require_once(dirname(__FILE__).'/pjmail/pjmail.class.php');
$mail = new PJmail();
$mail->setAllFrom('fromemail@domain.local', "Shift Reports");
$mail->addrecipient('email@domain.local');
$mail->addsubject("Operator Action Report For: ". date("m-d-y_Hi", time()));
$mail->text = "This is the shift report for:" . date("m-d-y_Hi", time()) . ". If you have any questions please contact your system Administrator.";
$mail->addbinattachement($filename, $content_PDF);
$res = $mail->sendmail();


Does anyone see any problem here?
pdfnovice

11

pdfnovice (./10) :
What I believe is happening is that the pdf process function may be cutting off the full parse of the PHP at the point where it fails


ti can't be that : it doesn't cut, it can't. if he says that there is a HTLML error, ther is a html error.

try with this PHP code :

require_once(dirname(__FILE__).'/../html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','en');
$html2pdf->setDefaultFont('Arial');
$html2pdf->WriteHTML($content, true);
exit;


and post the exact result here
Ancien pseudo : lolo