When I have an InlineImage in a horizontally centered paragraph, PrintPreview presents the image unevenly on the page. There should be the same space on left and right, as the page padding is the same all around. See the arrows indicated below:
Hello,
The problem lies in the difference between the size of A4 that System.Drawing.Printing.PrinterSettings returns and the one that Telerik.WinForms.Documents.Model.PaperTypeConverter.ToSize(PaperTypes.A4) returns. The first one returns a non-ISO size for A4 - Height=1169 Width=827, where as we are returning Height=1123 Width=793, which is a standard ISO size for A4 at 96 DPI. It seems that System.Drawing.Printing.PrinterSettings is returning the size at 100 DPI, which leads to the difference.var ps = new PrinterSettings();
var sizeA4 = ps.PaperSizes.Cast<PaperSize>().First(size => size.Kind == PaperKind.A4);
var printDocumentSettings = new RadPrintDocument();
if (sizeA4 != null) printDocumentSettings.DefaultPageSettings.PaperSize = sizeA4;
lbsection.PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);
var imageSize = ResizeKeepAspect(pictureBox1.Image.Size, (int)lbsection.PageSize.Height - 40, (int)lbsection.PageSize.Width - 40);
var ps = new PrinterSettings();
var sizeA4 = ps.PaperSizes.Cast<PaperSize>().First(size => size.Kind == PaperKind.A4);
...
lbsection.PageSize = new Telerik.WinControls.RichTextEditor.UI.Size(sizeA4.Width, sizeA4.Height);
var sizeA4 = PaperTypeConverter.ToSize(PaperTypes.A4);
printDocumentSettings.DefaultPageSettings.PaperSize = new PaperSize("Custom Paper Size A4", (int)sizeA4.Width, (int)sizeA4.Height);
Regards,
Dimitar
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hello, Kevin,
Thank you for the provided project. I was able to observe the same undesired behavior with the image alignment. I have logged this on our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.
I have also updated your Telerik Points.
Currently, due to the specifics of the issue, I am not able to suggest a workaround. Please excuse us for the inconvenience caused.
I hope this helps. If you have any other questions please let me know.
Regards,
Nadya
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.