4

私は動的入力テキストを扱っているので、ページは動的に作成する必要があります。ページ 1 が既にいっぱいの場合は、新しいページに書き込む必要があるため、処理されたデータに応じてページ 2、ページ 3 などを作成できます。

現在、私のテキストは切り捨てられています。ページ 1 のみを書き込み、残りのデータは書き込まれません。

以下の私の現在のコード:

//add page 1
theDoc.Page = theDoc.AddPage();
theDoc.AddImageHtml(html, true, 826, true);

//continue adding page if needed                             
while (theDoc.GetInfo(theID, "Truncated") == "1")
{
   theDoc.Page = theDoc.AddPage();
   theDoc.AddImageHtml(html, true, 826, true);
}

//save file
String pdfFilePath = WebConfigurationManager.AppSettings["pdfFilePath"];
Guid fileName = Guid.NewGuid();
pdfLink = pdfFilePath + fileName.ToString() + ".pdf";
theDoc.Save(pdfLink);
theDoc.Clear();

変数 html にはすべてのデータ (Web ページ) が含まれています。おそらく while ループに何かが欠けています。どんな助けでも大歓迎です!ありがとう

4

1 に答える 1

4
Found it, Use Chainable and then Flatten()

theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageUrl("http://www.yahoo.com/");

while (true) {
theDoc.FrameRect(); // add a black border
if (!theDoc.Chainable(theID))
  break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}

for (int i = 1; i <= theDoc.PageCount; i++) {
   theDoc.PageNumber = i;
  theDoc.Flatten();
}
于 2014-05-08T21:52:31.240 に答える