Well i was meant to say that i am creating a table from html string and that table is breaking up when it gets to second page. I am using following code to generate Pdf document
private void CreateDocument(Func<string> templateFunction)
{
//Create a PDF document in PDF_A1B standard
doc = new PdfDocument(PdfConformanceLevel.Pdf_A1B);
//Set page margins
doc.PageSettings.SetMargins(10);
//Set page orientation
doc.PageSettings.Orientation = PdfPageOrientation.Portrait;
//Set rotation
doc.PageSettings.Rotate = (PdfPageRotateAngle)Enum.Parse(typeof(PdfPageRotateAngle), "RotateAngle0");
PdfPage page = null;
SizeF pageSize = SizeF.Empty;
PdfUnitConvertor convertor = new PdfUnitConvertor();
float width = -1;
float height = -1;
page = doc.Pages.Add();
pageSize = page.GetClientSize();
width = convertor.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);
if (_showHeader)
{
//Adding Header
this.AddHeader(doc, "AMARK", "We belive in safety.");
}
if (_showFooter)
{
//Adding Footer
this.AddFooter(doc, "A-Mark Precious Metals, Inc. © " + DateTime.Now.Year);
}
HtmlConverter html = new HtmlConverter();
// setting Javascript
html.EnableJavaScript = false;
//// Setting Pagebreak
html.AutoDetectPageBreak = false;
// html.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
//// set hyperlink
html.EnableHyperlinks = true;
var str = templateFunction();
HtmlToPdfResult result = html.Convert(str, sourceUrl, ImageType.Metafile, (int)width, (int)height, AspectRatio.KeepWidth);
if (result != null)
{
PdfMetafile mf = new PdfMetafile(result.RenderedImage as Metafile);
mf.Quality = 100;
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;
doc.PageSettings.Height = result.RenderedImage.Size.Height;
format.SplitTextLines = true;
format.SplitImages = false;
result.Render(page, format);
}
}
Also attached the sample report and sample html string so that you can have a better idea. Main pin point for issue is " where table is continuing when page 1 ends and page starts "