32
Views
7
Comments
[Print PDF file by Network Printer] Printer name is invalid
Question
Forge component by Salman Ansari
8
Published on 02 Apr 2019

Hi,

I'm trying to use this component, but keep getting the following error:

An exception occurred while creating the PrintServer object. Win32 error: The printer name is invalid.


These are the inputs I'm passing:

PathOnDiskToCreatePDF: a valid path, because I have access to it and managed to write a file to it (so probably not relevant for this error)

PrinterServerName: my local IP address at home (also tried prefixing it with "\\", but to no avail)

PrinterName: the share name of the printer as it appears in my local network at home

PDFFileData: some random PDF file (probably not relevant for this error)


Am I using the wrong inputs for the PrinterServerName or PrinterName? 


Any insight would be much appreciated.

Kind regards,

Artuur

Rank: #44

Hi Artuur,

Are you passing below correct values to extension method also please check the read/write permission on path "PathonDiskToCreatePDF" in server

Rank: #1645

Hi Salman,

Thank you for your speedy reply. An example of what I'm passing to the PathOnDiskToCreatePDF input parameter is "D:\User\binaries\NetworkPrinter.pdf". This is similar to the path used in the HTML to PDF component on the forge where a temporary file also needs to be stored. I believe we have the correct permissions, because before I was using another path and was getting an error saying that access to the path was denied. But while using this path, that error no longer occurs.

I see you have attached a screenshot of example inputs to the forge component, but the images are rather small, so I couldn't zoom in enough to see if I perhaps made a mistake in the structure of the inputs.

Do you perhaps have an example of valid inputs to the 4 inputs or a sample oml I could look at to see if I spot any differences with my code?

Kind regards,

Art

Rank: #1645

Hi Salman,

Thank you for your reply. The printer is working, so it must be something in the request.

Can I ask where you get your values for PrinterServerName and PrinterName? 

Is PrinterServerName: "\\" + <the IP address of your network at home>?

Is PrinterName: <(for Windows 10) Settings -> Devices -> Printers &Scanners -> Click Printer -> Manage -> Printer Properties -> Sharing -> Share Name>? 

Rank: #1645

Thanks Salman,

This is what I am seeing at the moment:

I would like to print to the first printer. I think only the printer name is shown, since it is not controlled by a printer server, just connected to the wifi network. Does your component also work in this example?