Click here to Skip to main content
15,122,406 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Trying to print to a network printer using ip address. I can do it using printer name, but for this application I will only be getting the IP address once this app is in production. I tried to substitute the IP address in in printer settings, but I get an error that it is invalid.

pd.PrinterSettings.PrinterName = @"\\10.xx.xx.xx\10.xx.xx.xx";

You can't. The printer has to be already installed.

On some systems, that function is reserved for administrators only so you're app should not be creating printers. After all, you don't have the drivers for every printer type either.

Your app can only get the name of a printer to use that is already installed. You cannot use just the IP address.
Thanks for the reply, but the printer is installed. It is just that another application is sending the ip address and not the name. I just wanted to substitute the ip for the name, but it comes back as invalid.

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