如何在 iTextSharp PDF 中使用 WriteSelectedRows?
How to use WriteSelectedRows in iTextSharp PDF?
我正在开发一个自动生成发票的程序。我想总是在特定位置添加 table(例如在底角,或稍微向左)。
PdfContentByte cb = writer.DirectContent;
PdfPTable table = new PdfPTable(1);
table.TotalWidth = 400f;
table.AddCell("Test");
table.WriteSelectedRows(0, -1, 200, 50, cb);
我在 Google 上得到了上面的代码。但是我不明白如何使用 WriteSelectedRows
以及括号中的每个数字的含义。
我希望输出代码能够将 table 放在页面上我想要的任何位置。
谁能给我解释一下这个函数的具体用法?
值的意思是,according to the documentation:
- rowStart 整数
- rowEnd 整数
- xPos 浮动
- yPos 浮动
通过使用 rowStart = 0 和 rowEnd = -1,表示您要写入所有行。之后的参数指示呈现 table 的绝对位置,在您的情况下,距左侧 200 像素,距顶部 50 像素。
另请参阅:
* itextsharp: what is the height of a regular PDF page in pixels?
*
我正在开发一个自动生成发票的程序。我想总是在特定位置添加 table(例如在底角,或稍微向左)。
PdfContentByte cb = writer.DirectContent;
PdfPTable table = new PdfPTable(1);
table.TotalWidth = 400f;
table.AddCell("Test");
table.WriteSelectedRows(0, -1, 200, 50, cb);
我在 Google 上得到了上面的代码。但是我不明白如何使用 WriteSelectedRows
以及括号中的每个数字的含义。
我希望输出代码能够将 table 放在页面上我想要的任何位置。
谁能给我解释一下这个函数的具体用法?
值的意思是,according to the documentation:
- rowStart 整数
- rowEnd 整数
- xPos 浮动
- yPos 浮动
通过使用 rowStart = 0 和 rowEnd = -1,表示您要写入所有行。之后的参数指示呈现 table 的绝对位置,在您的情况下,距左侧 200 像素,距顶部 50 像素。
另请参阅:
* itextsharp: what is the height of a regular PDF page in pixels?
*