我正在尝试将一系列时间卡(最多150张)打印到pdf。它适用于一个记录,但失败超过20个。
以下是样本记录的代码
<div class='container'><h3>Timecard</h3><table style='table-layout: fixed;width:100%;text-align:left;'><tr><td class='infoItem' width='265px'><span class='fieldID'>Employee Name:</span> Gomez Addams</td><td class='infoItem'><span class='fieldID'>EE#:</span> 9502</td></tr><tr><td class='infoItem'><span class='fieldID'>Dept:</span> County Board</td><td colspan=2 align='left' class='infoItem'><h4><span class='fieldID'>JobID:</span> 13 <em class='fieldID grey'>(full-time non-exempt Sheriff Union contract with holiday)</em></h4></td></tr><tr><td class='infoItem'><span class='fieldID'>Payperiod:</span> 100 <em class='fieldID grey'>(Mar 10 to Mar 23 2012)</em></td><td class='infoItem'><span class='fieldID'>Pay Date:</span> Mar 30 2012</td></tr></table><hr />
<table class='timecard' width='658px'><tr><th class='timeHdr'>day</th><th class='timeHdr'>date</th><th class='timeHdr'>1000<br/>reg<br/>hrs</th><th class='timeHdr'>1004<br/>OT<br/>1x</th><th class='timeHdr'>1005<br/>OT<br/>1.5x</th><th class='timeHdr'>1035<br/>PTO<br/>used</th><th class='timeHdr'>1045<br/>comp<br/>used</th><th class='timeHdr'>1066<br/>comp<br/>1x</th><th class='timeHdr'>1067<br/>comp<br/>1.5x</th><th class='timeHdr'>other<br/>hrs</th><th class='timeHdr'>total<br/>hrs</th><th class='timeHdr'>1003<br/>hol<br/>prem</th><th class='timeHdr'>1007<br/>shift<br/>diff</th><th class='timeHdr'>1010<br/>out of<br/>class</th></tr>
<tr class='even'><td class='timeHdr'>sat</td><td align='center' class='timeHdr'>3/10</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row0'></div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>sun</td><td align='center' class='timeHdr'>3/11</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row1'></div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='even'><td class='timeHdr'>mon</td><td align='center' class='timeHdr'>3/12</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row2'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>tue</td><td align='center' class='timeHdr'>3/13</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row3'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='even'><td class='timeHdr'>wed</td><td align='center' class='timeHdr'>3/14</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row4'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>thu</td><td align='center' class='timeHdr'>3/15</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row5'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='even'><td class='timeHdr'>fri</td><td align='center' class='timeHdr'>3/16</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row6'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>sat</td><td align='center' class='timeHdr'>3/17</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row7'></div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='even'><td class='timeHdr'>sun</td><td align='center' class='timeHdr'>3/18</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row8'></div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>mon</td><td align='center' class='timeHdr'>3/19</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row9'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='even'><td class='timeHdr'>tue</td><td align='center' class='timeHdr'>3/20</td><td class='timeView'>4</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'>4</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row10'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>wed</td><td align='center' class='timeHdr'>3/21</td><td class='timeView'>3.5</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'>4.5</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row11'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='even'><td class='timeHdr'>thu</td><td align='center' class='timeHdr'>3/22</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row12'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr class='odd'><td class='timeHdr'>fri</td><td align='center' class='timeHdr'>3/23</td><td class='timeView'>8</td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td><td class='rowTot'><div id='row13'>8</div></td><td class='timeView'></td><td class='timeView'></td><td class='timeView'></td></tr>
<tr><td colspan=2 style='background: #e6f4ff;' class='timeHdr'>totals</td><td align='center' class='colTot'><div id='col0'>71.5</div></td><td align='center' class='colTot'><div id='col1'></div></td><td align='center' class='colTot'><div id='col2'></div></td><td align='center' class='colTot'><div id='col3'>8.5</div></td><td align='center' class='colTot'><div id='col4'></div></td><td align='center' class='colTot'><div id='col5'></div></td><td align='center' class='colTot'><div id='col6'></div></td><td align='center' class='colTot'><div id='col7'></div></td><td align='center' class='totTot'>80</td><td align='center' class='colTot'><div id='col9'></div></td><td align='center' class='colTot'><div id='col10'></div></td><td align='center' class='colTot'><div id='col11'></div></td></tr>
<tr><td colspan=2 class='timeHdr' style='vertical-align: top;'>comments</td><td colspan=14 class='comment'> </td></tr>
</table><hr /><table style='table-layout: fixed;width:100%;text-align:left;'><td colspan=2 ><em class='grey'>This form is due in the Auditor/Treasurer's Office by 9:00am on Monday after the end of the pay period. No overtime without authorization is allowed. I affirm that the information contained herein is true and correct to the best of my knowledge.</em></td></tr><tr><td colspan=2> </td></tr><tr><td class='infoItem' valign='top'><span class='fieldID'>Employee:</span> Gomez Addams</td><td class='infoItem'><span class='fieldID'>Supervisor:</span> </td></tr><tr><td class='infoItem'><span class='fieldID'>Employee Approved:</span> </td><td class='infoItem'><span class='fieldID'>Supervisor Approved:</span> </td></tr></table><br /></table>
<h4>Payroll Notes:</h4><p>note 4</p></div>
换行符与我收集的重要内容相同......
基于此,我接着说:
ini_set("memory_limit", "256M");
$stylesheet = file_get_contents('../css/timecardPDF.css');
$mpdf=new mPDF();
$mpdf->WriteHTML($stylesheet,1);
<loop>$html=above code;$mpdf->WriteHTML($html,2);</end loop>
$mpdf->Output('../timecards/file.pdf','F');
exit;
所以一切都应该是应该的,直到我尝试循环超过20次。如何将套件和kaboodle(150条记录)打印到pdf文档?
感谢您的善意考虑!
答案 0 :(得分:-1)
对于发生类似问题的任何人:事实证明它只是超时,因此扩展了php超时(set_time_limit(#ms))并且它可以工作(只需要一个时间过长!)