I'm trying to print an Image from a file, but Graphics.DrawImage crops the image when I try to print it. Example: When I try to print the Mona Lisa the output is cropped
This seemes to be the same problem but the solution doesn't work for me: DrawImage scales original image
My Code:
private void print()
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += PrintPage;
pd.PrinterSettings.PrinterName = "Microsoft Print to PDF";
pd.Print();
}
private void PrintPage(object o, PrintPageEventArgs e)
{
Image img = Image.FromFile(@"C:\Users\Leres75\Desktop\MonaLisa.jpg");
Rectangle rect = new Rectangle(0, 0, img.Width, img.Height);
img.Save(@"C:\Users\Leres75\Desktop\TestOutput.jpg"); //not Cropped
e.Graphics.DrawImage(img, rect);
}
I tried different variants of the DrawImage method and tried messing aroung with my screen settings to change the DPI but the output doesn't change.
How do I print the whole image?