Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

I'm using 3 printers.
I want to build the program that allow me to know what printer I used to print the report.

Example: When I print the report by printer A. It will note: Printed by printer A.

Please help me.
Posted

PrintOptions.PrinterName Property


Check this one it will help you..!
 
Share this answer
 
Hi,
This code will print the default printer-

C#
public static string DefaultPrinterName()
{
	string functionReturnValue = null;
	System.Drawing.Printing.PrinterSettings oPS = new System.Drawing.Printing.PrinterSettings();

	try
        {
		functionReturnValue = oPS.PrinterName;
	} 
        catch (System.Exception ex) {
		functionReturnValue = "";
	} 
        finally 
        {
		oPS = null;
	}
	return functionReturnValue;
}
 
Share this answer
 
Dear all,

I still cannot get the name of printer that I've just used it to print the report.

Not get the default printer name, I need to get the "used to print" printer name.

Thanks all.
 
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