Rank: Newbie Groups: Member
Joined: 12/9/2016 Posts: 2
|
Hello, I'm trying to fill an A4 page with a red background. There is always a white line at the bottom of the page in portrait. I do something wrong? Example : Quote:PdfDocument doc = new PdfDocument();
HtmlToPdfOptions options = new HtmlToPdfOptions(); options.PageSize = new SizeF(PdfPageSizes.A4.Width, PdfPageSizes.A4.Height); options.AutoAdjustForDPI = true; options.OutputArea = new RectangleF(0f, 0f, sizeF.Width, sizeF.Height); options.GeneratePageImages = true;
string contenuHtml = "<html><body><div style=\"background-color:red;width:794px;height:1123px;\">Contenu</div></body></html>";
var result = HtmlToPdf.ConvertHtml(contenuHtml, doc, options); for (int i = 0; i < result.PageImages.Length; i++) { var pageImage = result.PageImages[i]; var clonedImage = (Bitmap)pageImage.Clone(); clonedImage.SetResolution(clonedImage.HorizontalResolution * 1, clonedImage.VerticalResolution * 1); }
Thanks for help. Didier.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Have you tried to set OutputArea slightly bigger than PageSize? Because the numbers are in float, so there can be rounding errors.
Thanks!
|