I'm trying to print an image sized 2x2 inches. Created a conversion function (inches to pixels) based on the resolution. However, the result is far from 2x2 inch, printing produces image that barely fits the whole sheet! Am I'm doing something wrong?
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim graph = e.Graphics
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
e.Graphics.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
Dim photo = Image.FromFile("C:\Users\Public\Pictures\Sample Pictures\Koala.jpg")
graph.DrawImage(photo, New RectangleF(0, 0, InchToPx(graph.DpiX, 2), InchToPx(graph.DpiY, 2)))
End Sub
Private Function InchToPx(ByVal dpi As Single, ByVal inches As Single) As Single
Return (inches * dpi)
End Function