I want to export html to pdf, document is generated but only first page
Doc theDoc = new Doc();
theDoc.HtmlOptions.UseScript = true;
theDoc.HtmlOptions.Media = MediaType.Print;
theDoc.HtmlOptions.InitialWidth = 1048;
theDoc.HtmlOptions.ImageQuality = 101;
theDoc.HtmlOptions.UseScript = true;
theDoc.HtmlOptions.OnLoadScript = "(function(){ window.ABCpdf_go = false; setTimeout(function(){ window.ABCpdf_go = true; }, 55000); })();";
theDoc.HtmlOptions.Engine = EngineType.Gecko;
theDoc.HtmlOptions.PageLoadMethod = PageLoadMethodType.WebBrowserNavigate;
theDoc.HtmlOptions.ForMSHtml.UseScript = true;
int theID = theDoc.AddImageHtml(htmlContent);
while (true)
{
theDoc.FrameRect();
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();
}
theDoc.Save(HttpContext.Current.Server.MapPath("htmlimport.pdf"));
theDoc.Clear();
how I can to add all pages with Gecko? if I use MSHtml style from the page is not look good
To use the Gekoengine, add
to the document settings at the top.
You need to page the document as you add the HTML, just wrap what you have in a loop, I have set a upper limit to 50 pages, but if the document is large just up the loop.