我正在尝试从 HTML 字符串创建 PDF 文件,基本上 HTML 是一个包含几列的表。问题是当我生成 PDF 文件时,我无法看到所有列。
我尝试了几种选择,但到目前为止没有运气:
var generator = new NReco.PdfGenerator.HtmlToPdfConverter();
generator.CustomWkHtmlPageArgs = "--enable-smart-shrinking";
generator.CustomWkHtmlArgs = "--page-width value";
generator.PageWidth = Value;
此外,所有 HTML 元素(如 body 和 table)的 width=100%
如何使 HTML 适合一页?
这是 HTML:
<!doctype html>
<html lang="en">
<body >
<table border="1" width="100%">
<tr>
<th >Heat Id</th>
<th >Heat Order Id</th>
<th >MSP</th>
<th >Grade</th>
<th >Recipe</th>
<th >Shift</th>
<th >Crew</th>
<th >Start Date</th>
<th >End Date</th>
<th >Tap Date</th>
<th >Tap Wt. (Tons)</th>
<th >Scale Tap Wt. (Tons)</th>
<th >Cast Heat Wt.</th>
<th >Cast Slab Wt.</th>
<th >Charge Wt. (Tons)</th>
<th >Pseudo 1 Bucket</th>
<th >Scrap Wt. (Tons)</th>
<th >Scrap Flux Wt. (Tons)</th>
<th >Alloys Wt. (Lbs)</th>
<th >Tap Flux Wt. (Lbs)</th>
<th >MWH</th>
<th >Avg MW</th>
<th >KWH / Charge Ton</th>
<th >Tap To Tap Time A & B Furnace (min)</th>
<th >Tap To Tap Time Single Furnace (min)</th>
<th >Power On Time (min)</th>
<th >Power On %</th>
<th >Delay Time (min)</th>
<th >Tons / Hr</th>
<th >Total O2</th>
<th >Total O2 SS</th>
<th >Total Gas</th>
<th >Total C</th>
<th >Tap Temp</th>
<th >Tap C</th>
<th >Tap O2</th>
<th >Ladle ID</th>
<th >Comments</th>
<th >Auto Preheat On Time (min)</th>
<th >Auto Preheat Energy (MWH)</th>
<th >Heating/Lancing Energy (MWH)</th>
</tr>
</table>
</body>
</html>