要将文本添加到PDF文档并在文本不适合时创建新页面,可以使用以下代码.
theID = theDoc.AddHtml(theText)
While theDoc.Chainable(theID)
theDoc.Page = theDoc.AddPage()
theDoc.FrameRect
theID = theDoc.AddHtml("", theID)
Wend
Run Code Online (Sandbox Code Playgroud)
要将页码和页数添加到每个页面,请使用此选项.
theDoc.Rect = "100 50 500 150" 'position of page number
For i = 1 To theDoc.PageCount
theDoc.PageNumber = i
theDoc.AddText i & "/" & theDoc.PageCount
Next
Run Code Online (Sandbox Code Playgroud)
编辑:C#版本
Doc doc = new Doc();
doc.Page = doc.AddPage();
int id = doc.AddImageUrl("http://www.google.com/", true, 700, true);
while (true)
{
if (!doc.Chainable(id))
break;
doc.Page = doc.AddPage();
id = doc.AddImageToChain(id);
}
doc.Font = doc.AddFont("Arial");
doc.FontSize = 9;
for (int i = 1; i <= doc.PageCount; i++)
{
doc.PageNumber = i;
doc.Rect.String = "470 55 570 65";
doc.HPos = 1;
doc.AddText("Page " + i.ToString() + " of " + doc.PageCount.ToString());
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4031 次 |
| 最近记录: |