I'm trying to print an Image using PrintDocument
in C# but somehow the setting (like Number of Pages and Image Quality ) are ignored while printing and preview.
Is there anything wrong in following code, Am I missing something?
private void button1_Click(object sender, EventArgs e)
{
using (var printDialog = new PrintDialog())
{
if (printDialog.ShowDialog() == DialogResult.OK)
{
_printDocument.PrinterSettings = printDialog.PrinterSettings;
}
}
}
void _printDocument_Print(object sender, PrintPageEventArgs e)
{
using (Image image = new Bitmap("image0002.tif"))
{
e.Graphics.DrawImage(image, e.MarginBounds.X, e.MarginBounds.Y);
}
}