Hi, I have a HTML page that is just text and tables, when we convert it to pdf using html.FromString(), it only renders part of the page and not all of it. this might be just coincidental, but it always render up to 24 pages and after that the remaining pages are just blank pages. am I doing anything wrong?
I have attached a sample pdf of what gets rendered.
the page html is very simple:
Number |
Name |
Age |
---|
${row.Number} |
${row.Name} |
${row.Score} |
The code I used to do the conversion is as follows:
public void RenderPdf(string physicalPath, string markup)
{
var pdf = new PdfDocument();
var page = pdf.Pages.Add();
var converter = new PdfUnitConvertor();
var width = converter.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);
using (var html = new HtmlConverter())
{
html.EnableJavaScript = false;
html.AutoDetectPageBreak = true;
html.EnableHyperlinks = false;
var meta = html.FromString(markup, physicalPath, ImageType.Metafile, (Int32)width, -1, AspectRatio.KeepWidth) as Metafile;
var mf = new PdfMetafile(meta);
mf.Quality = 100;
var format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;
format.SplitTextLines = false;
format.SplitImages = false;
mf.Draw(page, new PointF(0, 0), format);
}
}
thank you so much, in advance, for your help.
Sample Report-20100604-191822_9a8d779c.zip