|
Rank: Newbie Groups: Member
Joined: 1/1/2013 Posts: 3
|
Hi I use pdfdocument for create pdf. I create html string and use following command for create pdf:
Code: C#
HtmlToPdf.ConvertHtml(totalPdfHtml, doc, htmlToPdfOptions);
But when I render document ,i get 40 pages for render which page count is 70 pages. Please help for rendering total 70 pages. Thank you for advance
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
How do you know it should be 70 pages? Is there any contents that's missing in the PDF file? When you use ConvertHtml, you must set HtmlToPdf.Options.BaseUrl correctly.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/1/2013 Posts: 3
|
Hi, I check PdfDocument (doc).Pages.Count property and i see it's 70 pages. This is my code
Code: C#
Runtime.AddLicense(licsense key );
HtmlToPdfOptions htmlToPdfOptions = new HtmlToPdfOptions();
htmlToPdfOptions.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit;
htmlToPdfOptions.AutoFitY = HtmlToPdfAutoFitMode.None;
htmlToPdfOptions.NoCache = true;
htmlToPdfOptions.GeneratePageImages = true;
htmlToPdfOptions.MaxLoadWaitTime = 200000;
htmlToPdfOptions.PageSize = new SizeF(8.5f, 11f);
htmlToPdfOptions.FooterHtmlPosition = 10f;
htmlToPdfOptions.OutputArea = new RectangleF(0f, 0f, 8.2f, 10f);
PdfDocument doc = new PdfDocument();
string totalPdfHtml = string.Empty;
string newPageHtml = "<hr style='border: 1px solid #FFFFFF;clear: both;page-break-before: always;width: 100%;'/>";
string html = string.Empty;
foreach (IdentificationInfo item in lstStuff)
{
// Create html string for each item
if (totalPdfHtml == "") // page 1
{
totalPdfHtml = tmpHtml;
}
else
{
totalPdfHtml = totalPdfHtml + newPageHtml + tmpHtml;
}
}
HtmlToPdf.ConvertHtml(totalPdfHtml, doc, htmlToPdfOptions);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-disposition", "attachment; filename=License.PDF");
doc.Save(Response.OutputStream);
the count of lstStuff is 70 items. Also i added following command,but yet i see 40 page for 70 pages in the rendering.
Code: C#
htmlToPdfOptions.BaseUrl = hostname;
It is very important for us. Please help. Thanks.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
That's not normal. If you see Pages.Count as 70, the PDF files should have 70 pages. If you can isolate the problem into a separate test project and send the test project to us, we will be happy to take a look. We will PM you as to where to send the sample code.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 1/1/2013 Posts: 3
|
Hi,
Thank you for support. I resolved it.the point is when you create huge string html and use HtmlToPdf.ConvertHtml command for the whole string at once, you see this problem(40 pages). If you use ConvertHtml for each item,It works fine.
//in this case you should see problem for() { // Create huge html string } HtmlToPdf.ConvertHtml(hugeHtml, doc);
//This one works fine for() { // Create html string HtmlToPdf.ConvertHtml(html, doc); }
Regards.
|
|