I am handling the PrintPageEventHandler
of the PrintDocument
in order to draw an image
to the Graphics
device using the Image.FromFile
Method.
I tried to set the dpi values up to 600 and also
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality
As suggested here but the printed image looks still pixeled and rough compared to printing the same file with e.g. Windows Photo Viewer , which gives a excellent result (tested on Windows 7).
I noticed that Paint.net uses WIA Printing Dialog - does this mean the Imagequality is a .NET limitation or am i just doing it wrong?
the complete method is here:
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
ev.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
ev.Graphics.SmoothingMode = SmoothingMode.HighQuality;
ev.Graphics.CompositingQuality = CompositingQuality.HighQuality;
ev.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
ev.Graphics.DrawImage(Image.FromFile(Global.APPDATA_PATH+ @"tmp\print.png"), ev.Graphics.VisibleClipBounds);
// Indicate that this is the last page to print.
ev.HasMorePages = false;
}