2

我在尝试渲染 pdf 时收到此错误。我正在将 Nicolas Leroux 的 PDF 模块用于播放框架。

这是整个堆栈跟踪:Pastebin。谷歌搜索仅显示 4 个结果。他们建议删除我已删除的任何浮动属性和位置属性,只是试一试。我仍然面临这个问题。有没有人能够解决这个问题?

编辑:这是呈现 pdf 的 html:

#{extends 'main.html' /} #{set title:'Salary Details' /}
<html>
<head>
<title>Employee Name</title>
<style>
body {
    font: 9pt Arial, Helvetica, sans-serif;
}

.container {
    margin: 0 auto;
    width: 1000px;
    border: 1px solid black;
    padding: 12px;
}

.logoClass {
    width: 200px;
    height: 85px;;
}

.companyAddressClass {
    width: 60%;
    margin: 0 auto;
    font-size: 17px;
    font-weight: bold;
    text-align: center;
}

.empClass table {
    width: 100%;
    border: 1px solid #ccc;
    border-collapse: collapse;
    margin: 10px 0px;
}

.empClass table th,td {
    border: 1px solid #ccc;
    padding: 5px 5px;
}

.empClass table th {
    background: #f2f2f2;
}
</style>
</head>

<body onload="window.print();">

    %{for(int i=0;i<dataList.size ();i=i+1){}%
    <div class="container" style="page-break-after:#{if i == dataList.size()-1} avoid;#{/if} #{else} always; #{/else}">
    <div class="logoClass"></div>
    <div class="companyAddressClass">
        ${dataList.get(i).distributorName},<br /> ${dataList.get(i).city},<br />
        ${dataList.get(i).state} <br /> <br /> <span>Payslip for the
            month of ${dataList.get(i).salaryMonth}</span>
    </div>
    <br class="clear" />
    <div class="empClass">
        <table border="1">
            <tr>
                <td>Employee No: ${dataList.get(i).employeeNumber}</td>
                <td>Location: ${dataList.get(i).location}</td>
            </tr>
            <tr>
                <td>Name: ${dataList.get(i).employeeName}</td>
                <td>Salary for the M/O: ${dataList.get(i).salaryMonth}</td>
            </tr>
            <tr>
                <td>Bank Name: ${dataList.get(i).bankName}</td>
                <td>Designation: ${dataList.get(i).designation}</td>
            </tr>
            <tr>
                <td>Bank Acc No: ${dataList.get(i).accountNumber}</td>
                <td>Join Date: ${dataList.get(i).joinDate}</td>
            </tr>
            <tr>
                <td>PF No: ${dataList.get(i).pfNumber}</td>
                <td>Gender: ${dataList.get(i).gender}</td>
            </tr>
            <tr>
                <td>ESI No: ${dataList.get(i).esiNumber}</td>
                <td>LOP: ${dataList.get(i).lop}</td>
            </tr>
            <tr>
                <td>PAN No: ${dataList.get(i).panNumber}</td>
                <td>Days Worked: ${dataList.get(i).daysWorked}</td>
            </tr>
        </table>
    </div>
    <br />
    <div class="empClass">
        <table border="1">
            <tr>
                <th colspan="3">Earnings</th>
                <th colspan="2">Deductions</th>
            </tr>
            <tr>
                <th align="left">Header</th>
                <th align="right">Actual</th>
                <th align="right">Paid</th>
                <th align="left">Header</th>
                <th align="right">Paid</th>
            </tr>
            <tr>
                <td>Basic</td>
                <td align="right">${dataList.get(i).basic}</td>
                <td align="right">${dataList.get(i).basic}</td>
                <td>PF</td>
                <td align="right">${dataList.get(i).pf}</td>
            </tr>
            <tr>
                <td>HRA</td>
                <td align="right">${dataList.get(i).hra}</td>
                <td align="right">${dataList.get(i).hra}</td>
                <td>ESICEE</td>
                <td align="right">${dataList.get(i).esicee}</td>
            </tr>
            <tr>
                <td>Conveyance Allowance</td>
                <td align="right">${dataList.get(i).conveynanceAllowance}</td>
                <td align="right">${dataList.get(i).conveynanceAllowance}</td>
                <td>ESICEE(PWS)</td>
                <td align="right">${dataList.get(i).esiceePWS}</td>
            </tr>
            <tr>
            <td>Medical Allowance</td>
                <td align="right">${dataList.get(i).medicalAllowances}</td>
                <td align="right">${dataList.get(i).medicalAllowances}</td>
                <td>PT</td>
                <td align="right">${dataList.get(i).pt}</td>
            </tr>
            <tr>
                <td>Special Allowance</td>
                <td align="right">${dataList.get(i).specialAllowance}</td>
                <td align="right">${dataList.get(i).specialAllowance}</td>
                <td>PT(PWS)</td>
                <td align="right">${dataList.get(i).ptPWS}</td>
            </tr>
            <tr>
                <td>Incentives</td>
                <td align="right">${dataList.get(i).midMonthAmountPWS}</td>
                <td align="right">${dataList.get(i).midMonthAmountPWS}</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td>Other Allowances</td>
                <td align="right">${dataList.get(i).otherAllowance}</td>
                <td align="right">${dataList.get(i).otherAllowance}</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td colspan="3" align="right">Total
                    Earnings:${dataList.get(i).totalEarnings}</td>
                <td colspan="2" align="right">Total Deduction
                    :${dataList.get(i).totalDeduction}</td>
            </tr>
            <tr>
                <td colspan="3">&nbsp;</td>
                <td colspan="2" align="right"><strong>Salary Credited
                        : ${dataList.get(i).salaryCredited}</strong></td>
            </tr>
        </table>

        <table>
        <thead>
            <tr>
                <th>Position Title</th>
                <th>City Name</th>
                <th>State Name</th>
            </tr>
        </thead>
        <thead>
            <tr>
                ..
                ..
                ..
                ..
                <th>${dataList.get(i).positionTitle}</th>
                <th>${dataList.get(i).cityName}</th>
                <th>${dataList.get(i).stateName}</th>
            </tr>
        </thead>
    </table>
    <br>
        <table>
        <thead>
            <tr>
                <th>Some Header</th>
                <th>Some Header</th>
                <th>Some Header</th>
                <th>Some Header</th>

            </tr>
        </thead>
        <tbody>
            <tr>
                <td align="center">Values</td>
                ..
                ..
                ..
                ..
                ..
            </tr>
        </tbody>
    </table>
    </div>
    <div>
        <span style="font-size: 15px; font-weight: bold;"> Salary
            Credited Amount(In Words): ${dataList.get(i).salaryCreditedInWord} </span>
    </div>
    </div>
    <br />
    <br />

    %{}}% 
</body>
</html>

我正在使用 Windows 7 和 Tomcat6 作为测试环境,这里的人们面临着同样的环境。

谢谢。

4

2 回答 2

3

此提交可以解决您的问题。您可以下载整个类并将其放入源代码中,因此您无需重新构建库 jar。

于 2017-06-16T13:39:23.183 回答
0

如果您遇到此问题,要解决此问题,只需在 td 内添加一个 span 标签并将样式添加到该 span 标签。例子:

<td>
<span style = style="position: absolute;">
</td>

基本上,如果您将样式添加到 td,您会因为飞碟 pdf 中的错误而收到错误。

于 2020-05-24T15:12:27.617 回答