我想从 HTML 中制作 PDF,我得到的是一个字符串。
它也有内联 CSS。
我的公司正在使用 DevExpress Package 来处理文档。
我已经写了下面的方法 -
public Stream Testing(string htmlString)
{
RichEditDocumentServer richEditDocumentServer = new();
richEditDocumentServer.HtmlText = htmlString;
MemoryStream ms = new();
richEditDocumentServer.ExportToPdf(ms);
ms.Position = 0;
return ms;
}
我的 HTML 和 CSS 没有在 PDF 中正确应用。它同时应用了它们,但没有以正确的方式应用。我没有得到与在浏览器中看到 html 时相同的结果。
下面是我的带有 CSS 的 HTML,您可以在任何在线 HTML 查看器中查看。
<!DOCTYPE html>
<html lang="en" class="font-md">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result Master View</title>
</head>
<body class="hrms2 ">
<div class="body-content">
<main class="main-content">
<div class=" customFormPage">
<!-- <div class="filter-row row d-flex align-items-baseline justify-content-between mb-4">
<h5 class="col-md-6">Paybill Preview</h5>
<div class="search-filter-upload col-md-6 d-flex justify-content-end">
<div class="searchBar">
<div class="form-group">
<div class="has-float-label">
<input type="search" class="form-control" id="Search" placeholder="Search">
<label for="Search">Search</label>
</div>
</div>
</div>
</div>
</div> -->
<div style="background-color:#F5F4F4; padding:8px; text-align: center; margin-bottom: 24px;">
<img src="../../images/govtlogo.svg" alt="" style="width: 100px;display: inline-block;">
<div style="display: inline-block; font-family: 'Noto Sans', sans-serif;">
<h5
style="font-weight:500;margin:0; color:#003078;line-height:24px;margin-bottom:2px;font-size:16px;">
Ministry of Minister</h5>
<p style="font-size: 14px;margin:0;margin-bottom: 2px;line-height: 24px;">Paybill Report for
Month Of January 2024</p>
<p style="font-size: 14px;margin:0;margin-bottom: 2px;line-height: 24px;">Department : Department
Department Department</p>
<p style="font-size: 14px;margin:0;margin-bottom: 2px;line-height: 24px;"><span>PAN Number :
BLRK07894F</span> | <span>Token Number : 12345</span></p>
</div>
<img src="../../images/govtlogo.svg" alt="" style="width: 100px;display: inline-block;">
</div>
<div style="margin-bottom: 24px;font-family: 'Noto Sans', sans-serif;">
<div style="padding: 20px 0 12px;border-top: 1px solid #F3F2F1;">
<p
style="margin: 0; font-weight: 500;font-size: 14px;line-height: 24px;color:#383F43; display: inline-block; width: 49%;">
Establishment No./ Name : 1</p>
<p
style="margin: 0; font-weight: 500;font-size: 14px;line-height: 24px;color :#383F43;text-align: right; display: inline-block;width: 49%;">
Final spanaybill To Be Represented To Treasury</p>
</div>
<div style="border-radius:12px 12px 0px 0px;border: 1px solid #F3F2F1;">
<div style="padding: 8px 20px 8px 12px; border-bottom: 1px solid #F3F2F1;">
<div style="display: inline-block; width: 33%;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">DDO
Code :</span>
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">
0200KT0002t</span></div>
<div style="display: inline-block; width: 33%; text-align: center;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Paybill
Type : Regular Salary</span></div>
<div style="display: inline-block; width: 33%; text-align: right;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Head Of
Account : 2052-00-099-0-01</span></div>
</div>
<div style="padding:8px 20px 8px 12px;">
<div style="width: 20%; display: inline-block;">
<span
style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Designation
: Superintendent</span></div>
<div style="width: 20%; display: inline-block; text-align: center;">
<span
style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">PayScale
: 37900 - 70850</span></div>
<div style="width: 19%; display: inline-block; text-align: center;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Days
Paid : 31</span></div>
<div style="width: 19%; display: inline-block; text-align: center;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">With
Hold Days : 0</span></div>
<div style="width: 20%; display: inline-block; text-align: right;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Next
Increment Date : 01 Aug 2024</span></div>
</div>
</div>
<table
style="border-collapse:collapse; padding: 8px 20px 8px 12px; width: 100%;border: 1px solid #F3F2F1;
background-image: url(../../images/ProvisionalPayslipBG.svg);background-repeat: no-repeat;background-position:center;background-size: contain;">
<thead>
<tr>
<th style="border: 1px solid #F3F2F1;padding: 8px 20px 8px 12px !important;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word; text-align: left;">S.No</span></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Employee Name</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">KGID/ Metal No.</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"> </th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Basic Pay</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Allowances</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Gross Salary</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Deductions</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Recoveries</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Total Deductions</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Net Salary</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
</tr>
</thead>
<tbody>
<tr style="border: 1px solid #F3F2F1;">
<td style=" border: 1px solid #F3F2F1;font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">1</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">Pooran Chandra M</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">KGID : 998807</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">1746805</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">39800</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;"><span>DA : 2587</span><br>
<span> HRA : 9552</span><br>
<span> CCA : 500</span><br>
<span> Medical Allowance : 200</span><br>
</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">52039</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;"><span>PT : 200</span><br>
<span>IT : 4500</span><br>
<span>KGID : 2000</span><br>
<span> EGIS : 240</span><br>
<span> GPF : 10000</span><br>
<span> LIC : 2374</span><br>
<span>LIC SSYAX : 13</span><br>
<span>CONDENDC : 100</span><br>
</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">19427</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">33212</td>
</tr>
</tbody>
</table>
</div>
<div style="margin-bottom: 24px;font-family: 'Noto Sans', sans-serif;">
<div style="padding: 20px 0 12px;border-top: 1px solid #F3F2F1;">
<p
style="margin: 0; font-weight: 500;font-size: 14px;line-height: 24px;color:#383F43; display: inline-block; width: 49%;">
Establishment No./ Name : 1</p>
<p
style="margin: 0; font-weight: 500;font-size: 14px;line-height: 24px;color :#383F43;text-align: right; display: inline-block;width: 49%;">
Final spanaybill To Be Represented To Treasury</p>
</div>
<div style="border-radius:12px 12px 0px 0px;border: 1px solid #F3F2F1;">
<div style="padding: 8px 20px 8px 12px; border-bottom: 1px solid #F3F2F1;">
<div style="display: inline-block; width: 33%;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">DDO
Code :</span>
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">
0200KT0002t</span></div>
<div style="display: inline-block; width: 33%; text-align: center;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Paybill
Type : Regular Salary</span></div>
<div style="display: inline-block; width: 33%; text-align: right;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Head Of
Account : 2052-00-099-0-01</span></div>
</div>
<div style="padding:8px 20px 8px 12px;">
<div style="width: 20%; display: inline-block;">
<span
style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Designation
: Superintendent</span></div>
<div style="width: 20%; display: inline-block; text-align: center;">
<span
style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">PayScale
: 37900 - 70850</span></div>
<div style="width: 19%; display: inline-block; text-align: center;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Days
Paid : 31</span></div>
<div style="width: 19%; display: inline-block; text-align: center;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">With
Hold Days : 0</span></div>
<div style="width: 20%; display: inline-block; text-align: right;">
<span style="font-weight: 500;font-size: 14px;line-height: 24px;color: #383F43;">Next
Increment Date : 01 Aug 2024</span></div>
</div>
</div>
<table
style="border-collapse:collapse; padding: 8px 20px 8px 12px; width: 100%;border: 1px solid #F3F2F1;
background-image: url(../../images/ProvisionalPayslipBG.svg);background-repeat: no-repeat;background-position:center;background-size: contain;">
<thead>
<tr>
<th style="border: 1px solid #F3F2F1;padding: 8px 20px 8px 12px !important;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word; text-align: left;">S.No</span></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Employee Name</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">KGID/ Metal No.</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"> </th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Basic Pay</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Allowances</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Gross Salary</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Deductions</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Recoveries</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Total Deductions</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
<th style="text-align: left; padding: 8px 12px;">
<span style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Net Salary</span>
<img src="../../images/data-table-arrow-down.svg" alt="" style="vertical-align: middle; width: 14px;"></th>
</tr>
</thead>
<tbody>
<tr style="border: 1px solid #F3F2F1;">
<td style=" border: 1px solid #F3F2F1;font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">1</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">Pooran Chandra M</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">KGID : 998807</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">1746805</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">39800</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;"><span>DA : 2587</span><br>
<span> HRA : 9552</span><br>
<span> CCA : 500</span><br>
<span> Medical Allowance : 200</span><br>
</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">52039</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;"><span>PT : 200</span><br>
<span>IT : 4500</span><br>
<span>KGID : 2000</span><br>
<span> EGIS : 240</span><br>
<span> GPF : 10000</span><br>
<span> LIC : 2374</span><br>
<span>LIC SSYAX : 13</span><br>
<span>CONDENDC : 100</span><br>
</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">19427</td>
<td style="font-size: 14px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;padding:8px 12px;word-wrap: break-word;vertical-align: top;">33212</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</main>
</div>
</body>
</html>
您可以从这里查看下载的PDF图像。您可以看到它的格式与 HTML 查看器中的格式不正确。当我使用 Puppeteer 包执行此操作时,它会按我想要的方式下载 PDF,但我的公司只想使用 DevExpress。
请帮忙,因为我不知道如何使用这个包
我通过解决这个问题并使用 A4 尺寸纸张的宽度(210 毫米)重新编写 HTML 来完成此操作。现在我的 HTML 看起来像 -
<!DOCTYPE html>
<html lang="en" class="font-md">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Result Master View</title>
</head>
<body class=" ">
<div class="body-content">
<main class="main-content">
<div class=" customFormPage">
<div style="max-width: 600px; margin: auto;">
<table style="border-collapse:collapse; width: 100%;margin-bottom: 24px;">
<tbody>
<tr style="background-color:#F5F4F4; padding:8px; text-align: center; ">
<td style="display: inline-block; font-family: 'Noto Sans', sans-serif; width: 60%;">
<h5
style="font-weight:500;margin:0; color:#003078;line-height:24px;margin-bottom:2px;font-size:16px;">
Government of ABSDFASDFASD</h5>
<p style="font-size: 12px;margin:0;margin-bottom: 2px;line-height: 24px;">Paybill
Report
for
Month Of January 2024</p>
<p style="font-size: 12px;margin:0;margin-bottom: 2px;line-height: 24px;">Department
:
Department
Department Department</p>
<p style="font-size: 12px;margin:0;margin-bottom: 2px;line-height: 24px;"><span>PAN
Number :
BLRK07894F</span> | <span>Token Number : 12345</span></p>
</td>
</tr>
</tbody>
</table>
<div style="margin-bottom: 24px;font-family: 'Noto Sans', sans-serif;">
<table style="border-collapse:collapse; width: 100%;">
<tbody style="">
<tr>
<td style="border-top: 1px solid #F3F2F1;padding: 20px 0 12px;">
<p
style="margin: 0; font-weight: 500;font-size: 12px;line-height: 24px;color:#383F43; ">
Establishment No./ Name : 1</p>
</td>
<td style="border-top: 1px solid #F3F2F1;padding: 20px 0 12px;">
<p
style="margin: 0; font-weight: 500;font-size: 12px;line-height: 24px;color :#383F43;text-align: right; ">
Final spanaybill To Be Represented To Treasury</p>
</td>
</tr>
</tbody>
</table>
<div>
<table style="border-collapse:collapse; width: 100%;">
<tbody>
<tr style="border-radius:12px 12px 0px 0px;border: 1px solid #F3F2F1;">
<td style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">DDO
Code :</span>
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">
0200KT0002t</span>
</td>
<td colspan="2" style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">Paybill
Type : Regular Salary</span>
</td>
<td colspan="2" style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">Head
Of
Account : 2052-00-099-0-01</span>
</td>
</tr>
<tr style="border-radius:12px 12px 0px 0px;border: 1px solid #F3F2F1;">
<td style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">Designation
: Superintendent</span>
</td>
<td style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">PayScale
: 37900 - 70850</span>
</td>
<td style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">Days
Paid : 31</span>
</td>
<td style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">With
Hold Days : 0</span>
</td>
<td style="padding: 8px 20px 8px 12px;">
<span
style="font-weight: 500;font-size: 12px;line-height: 24px;color: #383F43;">Next
Increment Date : 01 Aug 2024</span>
</td>
</tr>
</tbody>
</table>
</div>
<table
style="border-collapse:collapse; padding: 8px 20px 8px 12px; width: 100%;border: 1px solid #F3F2F1; position: relative;">
<thead>
<tr>
<th style="border: 1px solid #F3F2F1;">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word; text-align: left;">S.No</span>
</th>
<th style="text-align: left; padding: 3px; padding: 3px;">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Employee
Name</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">KGID/
Metal No.</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Basic
Pay</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Allowances</span>
</th>
<th style="text-align: left; padding: 3px;">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Gross
Salary</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Deductions</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Recoveries</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Total
Deductions</span>
</th>
<th style="text-align: left; padding: 3px; ">
<span
style="font-size: 12px;color:#000;font-style: normal;font-weight: 500;
line-height: 24px;position: relative;text-transform: capitalize;word-wrap: break-word;">Net
Salary</span>
</th>
</tr>
</thead>
<tbody style="">
<tr style="border: 1px solid #F3F2F1;">
<td style=" border: 1px solid #F3F2F1;font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">1</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">Pooran
Chandra M</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">KGID :
998807</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">1746805
</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">39800
</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;"><span>DA
: 2587</span><br>
<span> HRA : 9552</span><br>
<span> CCA : 500</span><br>
<span> Medical Allowance : 200</span><br>
</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">52039
</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;"><span>PT
: 200</span><br>
<span>IT : 4500</span><br>
<span>KGID : 2000</span><br>
<span> EGIS : 240</span><br>
<span> GPF : 10000</span><br>
<span> LIC : 2374</span><br>
<span>LIC SSYAX : 13</span><br>
<span>CONDENDC : 100</span><br>
</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">19427
</td>
<td style="font-size: 12px;color:#383F43;font-style: normal;font-weight: 400;
line-height: 24px;word-wrap: break-word;vertical-align: top; padding: 3px;">33212
</td>
</tr>
<tr>
<td colspan="10">
<img src="../../images/ProvisionalPayslipBG.svg" alt=""
style="position: absolute;top: 79px; max-width: 590px; ">
</td>
</tr>
<tr>
<td colspan="10">
<img src="../../images/payslip-logo.png" alt="" style="position: absolute;bottom: 10px;left: 50%;transform: translateX(-50%);">
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
</div>
</body>
</html>
C#代码是-
私有静态异步任务
var document = richEditDocumentServer.Document;
document.CompatibilitySettings.AllowTablesOutstepMargins = false;
document.CompatibilitySettings.AllowHyphenationAtTrackBottom = false;
document.CompatibilitySettings.AllowTextAfterFloatingTableBreak = false;
document.CompatibilitySettings.DifferentiateMultirowTableHeaders = false;
document.CompatibilitySettings.SplitPageBreakAndParagraphMark = false;
document.CompatibilitySettings.SplitTableRowsAroundFloatingTables = false;
document.CompatibilitySettings.SplitWrappedTablesAcrossPages = false;
document.CompatibilitySettings.StretchLinesWithLineBreaks = false;
document.Unit = DevExpress.Office.DocumentUnit.Millimeter;
document.Sections[0].Page.Width = 210;
document.Sections[0].Page.Height = 297;
document.Sections[0].Margins.Top = 1.5f;
document.Sections[0].Margins.Bottom = 1.5f;
document.Sections[0].Margins.Left = 2;
document.Sections[0].Margins.Right = 2;
string filePath = Path.Combine(_webHostEnvironment.WebRootPath, "Images", ConstantsHelper.Watermark);
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.Washout = false;
imageWatermarkOptions.Scale = 0.75;
using FileStream fs = new(filePath, FileMode.Open);
document.WatermarkManager.SetImage(Image.FromStream(fs), imageWatermarkOptions);
var options = new DevExpress.XtraPrinting.PdfExportOptions();
options.ConvertImagesToJpeg = false;
options.ImageQuality = DevExpress.XtraPrinting.PdfJpegImageQuality.Highest;
await richEditDocumentServer.ExportToPdfAsync(ms, options);
ms.Seek(0, SeekOrigin.Begin);
return ms.ToArray();
}
这不是完美或最好的解决方案,但它可以完成工作。在这个解决方案中,我必须做出我的