Rank: Newbie Groups: Member
Joined: 4/10/2012 Posts: 1
|
Hi,
We are using the following HTML code to manually create a page break when converting an HTML page to PDF:
<div style="page-break-before: always"></div>
The code works just fine when we try it online on your EO.Pdf live demo page but it does not work for us locally. Below is the c# code we are using to convert HTML pages to PDF; however, the resulting PDF documents are not generating the additional pages. Your help will be greatly appreciated.
HtmlToPdf.Options.PageSize = EO.Pdf.PdfPageSizes.Letter;
if (landscape) { HtmlToPdf.Options.PageSize = new SizeF(11f, 8.5f); }
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit;
//Set margins on all sides HtmlToPdf.Options.OutputArea = new RectangleF(x, y, width, height); HtmlToPdf.Options.AutoAdjustForDPI = false;
HtmlToPdf.ConvertUrl(documentUri, fileNamePath);
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, You will want to check whether you have any other conflicting page-break CSS attribute. For example, if you have the following CSS:
Code: HTML/ASPX
<div style="page-break-inside:avoid;height:100px;">
</div>
<div style="page-break-before:always;margin-top:-10px;height:100px;">
</div>
In this case, the two directives conflict because the two DIVs overlap with each other (due to the negative margin on the second DIV). There is no way for the converter to honor both directives because if it were to honor the first one, then it can not honor the second one, and if it were to honor the second one, it will break the first one. In this case you will have to modify your HTML to fix the problem. Hope this helps you resolve the problem. Thanks!
|