|
Hey! i have a similar problem.
If i'm printing from a local application in works fine, even when printing to a shared printer on a different PC.
When i try to print from my asp web site, it throws the "invalid parameter: handle" error.
How do i resolve this issue?
Mihai
|
|
|
|
|
If your web site runs on Windows Server 2008 most likely the error comes from insufficient rights NETWORK SERVICE has on accessing external resources. In this case the only solution I found was to create a normal user, and set pe application pool run on it.
If this is not the case try to get the last IO error using:
System.ComponentModel.Win32Exception ex = new System.ComponentModel.Win32Exception();
errMsg = ex.Message;
and investigate from there...
Mircea
|
|
|
|
|
10x Mircea.
Changing the user solved my problem
Mihai
|
|
|
|
|
Please can you explain where you changed the user in the web config file??
Thank you.
|
|
|
|
|
Has anybody been able to print images (PCX format) to a zebra printer? could you post an example code?. thanks
|
|
|
|
|
Hello.
i've just finished doing this. it's not complicated: you just need to share this code so that the filestream you're using uses the correct encoding (i've used the 1252 encoding).
After changing this, you just need to use the bitmap class and its lockbits method in order to get the stride in order to copy the bits to the stream that is sent to the printer.
i'll be publishing an article about this in my blog in the next days:
http://msmvps.com/blogs/luisabreu
--
Regards,
Luis Abreu
|
|
|
|
|
Hi Luis, thank you for your reply, I've been able to print images to my zebra printers (QL320, QL420+) using an excellent project developed by Vino Rodrigues. His project is "Z-Bar: .NET for Zebra Printer" hosted on http://sourceforge.net/projects/z-bar/[^], wich works with CF2. I didn't specify that I was working with CF1 and it's bitmap class doesn't have a lockbits method. Anyway, I'll read your post as soon as possible.
|
|
|
|
|
The code has been create to use with the LTP port, it works perfect, but if I want to print using the USB port, how can i do it?
Thank you
|
|
|
|
|
Ha sido un error mío. He confundido la solución con el enlace de partida, que solo estaba pensado para LPT. Cambiando el nombre de la impresora funciona perfectamente.
Siento la confusión.
|
|
|
|
|
what?! this website is english.
|
|
|
|
|
Within your Printer Properties, you can enable printer spooling and map it to both the USB00x AND LPT1 ports. Then even a USB connected printer will work when printing to LPT1
-----------------------------
Clint MacDonald, BASc, Civ. Eng
InterGlobal Solutions
Waterloo, Ontario Canada
519-576-1644
http://www.interglobal.ca
|
|
|
|
|
I've included USB support in Z-Bar project (http://z-bar.sf.net) - may not be an "out of box" solution for you - but you can leverage the source base to expand to your needs.
Vino Rodrigues
|
|
|
|
|
Set up the printer with a USB connection and then share the printer - after it is shared you can use the UNC path (\\mycomputername\printername).
I was unable to get my Zebra S4M USB printer to work, I kept getting invalid handle errors, using the UNC path I was able to get it to work.
|
|
|
|
|
Does this work with zebra mobile printers (I need to print in QL420 from a PocketPC via Bluetooth)? If so, which will be the printerPath? thanks
|
|
|
|
|
I don't know, I'm not fimiliar with bluetooth and haven't done much development on a pocket PC. I guess the only to know is to try it. You could try the name of the bluetooth device as the printerPath.
|
|
|
|
|
I get an exception when using this, during the create filestream, complaining about an invalid parameter (parameter name: handle).
This is the exception:
System.ArgumentException: Invalid handle.<br />
<br />
Parameter name: handle<br />
<br />
at System.IO.FileStream..ctor(SafeFileHandle handle, FileAccess access, Int32 bufferSize, Boolean isAsync)<br />
<br />
at System.IO.FileStream..ctor(SafeFileHandle handle, FileAccess access, Int32 bufferSize)
And this is the line the error is coming from:
_outFile = New FileStream(hPortP, FileAccess.Write)
Any thoughts or suggestions?
|
|
|
|
|
It's probably has something to do with the printerPath variable. What I used to test it was a network unc printer path. The example is using the literal "\\pc-0556\\VantageT" so you would have to replace that with your own.
|
|
|
|
|
i am having the same issue as well. i am using
print.StartWrite("\\50.33.94.74\\50.33.94.111")
50.33.94.74 is my unix server which i put my printer to.
50.33.94.111 is the printer address
please help
|
|
|
|
|
That actually means that a safefilehandle has to be implemented instead of an unsafe pointer..
well, just use the dll that comes with the sample
|
|
|
|
|
|
I think it would be better if you could abstract all the ZPL Commands for users to use.
|
|
|
|