GM
Geetha M
Syncfusion Team
March 24, 2009 01:50 PM UTC
Hi Patrice,
Thank you for your interest in Syncfusion products.
I am working on creating a test sample and will get back to you tomorrow.
Regards,
Geetha
GM
Geetha M
Syncfusion Team
March 26, 2009 12:55 PM UTC
Hi Patrice,
Thank you for your patience.
I tried creating the sample. I was able to see that Essential PDF takes less than 50 MB to create 250 files using the render code itself. I used the below code:
PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
SizeF pageSize = page.GetClientSize();
PdfMetafile mf;
HtmlToPdfResult result;
PdfUnitConvertor convertor = new PdfUnitConvertor();
float width = convertor.ConvertToPixels(page.GetClientSize().Width, PdfGraphicsUnit.Point);
float height = convertor.ConvertToPixels(page.GetClientSize().Height, PdfGraphicsUnit.Point);
PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
format.Break = PdfLayoutBreakType.FitPage;
format.Layout = PdfLayoutType.Paginate;
format.SplitTextLines = true;
format.SplitImages = true;
// get each file or check for the count here
foreach (string file in files)
{
doc = new PdfDocument();
page = doc.Pages.Add();
infile = new FileInfo(file);
html = new HtmlConverter();
result = html.Convert(pathOrigine, ImageType.Metafile, (int)width, -1, AspectRatio.KeepWidth);
mf = new PdfMetafile(result.RenderedImage as System.Drawing.Imaging.Metafile);
mf.Quality = 100;
doc.PageSettings.Height = result.RenderedImage.Size.Height;
result.Render(page, format);
//mf.Draw(page, new PointF(0, 0), format);
mf.Dispose();
html.Dispose();
doc.Save(Server.MapPath("") + "/PDF/" + pathDestination);
doc.Close(true);
}
I would suggest you to use the above code or a similar one, because, whenever you create a new page, the ClientSize is not going to be changed. Also, the format can be defined outside the loop as both width and format are not going to change as you are creating a new PDF for every HTML file. Also, it would be helpful if you send us your HTML file so that I could recreate the problem and find the cause of the same.
Please let me know if you have any difficulties.
Regards,
Geetha