Search code examples
c#asp.nethtmlabcpdf

abcPDF 7 converting HTML to PDF but only getting the first page converted


I'm currently using abcPDF 7 to convert HTML to PDF. This is done via an ASPX page where I override the Render method.

Doc theDoc = new Doc();
theDoc.SetInfo(0, "License", m_License );
theDoc.HtmlOptions.Paged = true;
theDoc.HtmlOptions.Timeout = 1000000;

string callUrl = "http:// my app page";
theDoc.AddImageUrl(callUrl);
Response.Clear();

Response.Cache.SetCacheability(HttpCacheability.Private);
Response.AddHeader("Content-Disposition", "attachment; filename=" + sFile + ".pdf");
Response.ContentType = "application/octet-stream";

theDoc.Save(Response.OutputStream);

Response.Flush();

This works perfectly for the first page but then truncates the page and does not continue rendering the remaining pages.

Does anyone know why it stops after a page?


Solution

  • "Only the first page of the document is drawn. Subsequent pages can be drawn using the AddImageToChain method."

    From here

    An example how to use AddImageToChain can be found here