Click here to Skip to main content
15,901,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

I want to change the tray of the printer I am using. I am using the PrintDocument class and the following is the code im working with
C#
for (int i = 0; i < printDocument.PrinterSettings.PaperSources.Count; i++)
{
    printDocument.DefaultPageSettings.PaperSource.SourceName = printerSettings.PaperSources[i].SourceName;
    printDocument.Print();
}

The printer paper sources appear to be 17 even though the actualy printer have 3 only. And every time i try to change the papersource in this loop, it doesnt change, the SourceNam stays "Automatically Selected" after the assignment.

I am not able to change the SourceName of the printDocument.

Any assistance would be appreciated

thank you
Posted
Updated 23-Jun-11 2:27am
v4

1 solution

Hello,

Have you tried?

MIDL
printDocument.DefaultPageSettings.PaperSource = printerSettings.PaperSources[i];


There is an article on MSDN demonstrating how it should be done:

http://msdn.microsoft.com/en-us/library/system.drawing.printing.pagesettings.papersource.aspx[^]

Valery
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900