This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C#/DotNet Iprint errors - The printer name is invalid

Hi Legends.  I'm hoping to pick your brains and get some help.

I'm working at a site where there is a iPrint deployment using short printer name  (eg  \\Site\AA123456-p6 ) as the installed printer names.

When we select this printer name  and try to print within our application/test tool written in DotNet we get a generated error stating that the printer name is invalid.  the FQDN port ipp://iPrint.Server.FQDN.com/iprint/AA123456-p6 does resolve and i can browse via the HTTP address.  The short name \\Site does not resolve by ping or DNS nslookup on the host system
no matter what I do or configure I cannot get this printer to work.

The only threads and info I can find about this are 10 or more years old and don't seem to address my issue.

The code for our test tool is as follow;

private static System.Printing.PrintServer GetPrintServer(string servername)
{
System.Printing.PrintServer ps = null;
if (string.IsNullOrEmpty(servername))
{
// local printer name
ps = new System.Printing.LocalPrintServer();
}
else
{
// network printer share
ps = new System.Printing.PrintServer(servername);
}
return ps;
}

public static System.Printing.PrintQueue GetPrintQueue(string printServer, string printQueue)
{
System.Printing.PrintQueue pq = null;
System.Printing.PrintServer ps = GetPrintServer(printServer);
if (ps != null)
pq = ps.GetPrintQueue(printQueue);
return pq;
}

When we try to resolve the short name it fails.  Are we missing something when trying to call GetPrinterServer?
'Print and Document service' is installed.
Test tool is here: https://drive.google.com/file/d/1746kgmWbCIchqxkBZqjP5RDZrN7QhVXC/view?usp=sharing if you have a similar site and can try to replicate?

Any help is really appreciated!

Tags:

  • 0

    Error log capture should it help/for searching

    2 - Value - 15:08:30 25/08/2021 - PrinterSettings.PrinterName = "\\SITE\QH123456-P6"
    2 - Value - 15:08:30 25/08/2021 - Regex matched: Server="\\SITE", printer="QH123456-P6"
    2 - Value - 15:08:30 25/08/2021 - ServerName="\\SITE", PrinterName="QH123456-P6"
    2 - Value - 15:08:37 25/08/2021 - About to call Utils.GetPrintQueue("\\SITE", "QH123456-P6")
    2 - Value - 15:08:37 25/08/2021 - About to call GetPrintServer("\\SITE")
    3 - Catch - 15:08:41 25/08/2021 - System.Printing.PrintServerException: An exception occurred while creating the PrintServer object. Win32 error: The printer name is invalid.

    at System.Printing.PrintServer.Initialize(String path, String[] propertiesFilter, PrinterDefaults printerDefaults)
    at System.Printing.PrintServer..ctor(String path)
    at Private.Classes.Printing.Utils.GetPrintServer(String servername)
    at Private.Classes.Printing.Utils.GetPrintQueue(String serverName, String printerName)
    at PrintLogger.PrintLogInterface.printButton_Click(Object sender, EventArgs e)

  • 0

    anyone?
    we have been able to print to this printer name using word, but still cant access it directly.

  • 0 in reply to 

    bueller...bueller???
    Anyone.

  • 0 in reply to 

    As this is a community forum (not official support) and you haven't received a response yet, I'm assuming no one has run into this problem or knows a resolution.  Quite honestly, I've never implemented short printer names and have no experience with them.  If you can't get anywhere with this, you might consider opening a support request.