Joel Hess

I'm trying to print an image and an finding out that the color matching options that are specified in the driver are not being applied. Specifically, there is supposed to be an ICM Color Profile applied to the output that isn't. I'm not doing anything special, just Graphics.DrawImage(), and PrintDocument.Print.

I can't find anything in the documentation that says that I am responsible for applying it, and I would expect that most other people that are printing color images are not specifing a color profile to use.

Here's my Printing code:

Code Snippet

PrintDialog DlgSettings = new PrintDialog();

DlgSettings.Document = printDocument1;

if (chkDuplex.Checked == true)

{

iNumPages = 2;

}

else

{

iNumPages = 1;

}

if (picList[currentIndex].orientation == Picture.Orientation.LANDSCAPE)

{

printDocument1.DefaultPageSettings.Landscape = true;

}

else

{

printDocument1.DefaultPageSettings.Landscape = false;

}

printDocument1.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);

printDocument1.PrinterSettings.PrinterName = m_strPrinterName;

printDocument1.PrinterSettings.Copies = 1;// (short)this.numCopies.Value;

//printDocument1.PrintController = spController;

for (int i = 0; i < Convert.ToInt32(this.numCopies.Value); i++)

{

iPageNumber = 1;

printDocument1.Print();

}

Here's my Drawing Code:

Code Snippet

float x = 0; //e.MarginBounds.Left;

float y = 0; //e.MarginBounds.Top;

Console.WriteLine("Page Margins are " + x.ToString() + ", " + y.ToString());

float h = e.PageSettings.PaperSize.Height;

float w = e.PageSettings.PaperSize.Width;

Console.WriteLine("Page Size is " + h.ToString() + ", " + w.ToString());

//define orientation of the card

if (picList[currentIndex].orientation == Picture.Orientation.LANDSCAPE)

{

e.Graphics.DrawImage(Image.FromFile(picList[currentIndex].FileName), x, y, h, w);

}

I've been looking at the ImageAttribute Class but that appears to be for applying a color transform for each image object that is rendered. I just want to use whatever the Printer is set to use.

Any suggestions

Joel Hess


Re: Windows Forms General Printing an Image with Color Profiles

nobugz

Try using the Bitmap(string, bool) overload when you load the bitmap. Pass true for the last argument (useIcm).