IrDA Print Jobs from Win CE

  • Thread starter Thread starter Noir
  • Start date Start date
N

Noir

Hi everybody,

I'm working on this project to send print jobs to the printer. I had opened
the port and I tried sending data over such as text like “Hello World” but
the printer refused to print. The light flickers and beeped for a second. The
problem now is that whether I’m sending the right information over. My
printer is a Zebra QL420 Mobile Printer. I tried sending CPCL printer
language but still it doesn’t print out. According to some threads, I have to
add CR, LF and FF to it, but the question now is how do I set the format to
send to the printer or how do I add the CR/LF/FF to it to have the different
new line? Your help is deeply appreciated.

Below are the sample CPCL codes:

! 0 200 200 3 1
TEXT 4 0 30 40 Hello World
FORM
PRINT

Regards,
Ian
 
Ian,

Assuming you've got an object named myPrinter that can send output to the
port using a method named Write:

myPrinter.Write("! 0 200 200 3 1\r\n"); // sets form size
myPriner.Write("TEXT 4 0 30 40 Hello World\r\n"); // outputs text
myPrinter.Write("FORM\r\n"); // not used in my printer code
myPrinter.Write("PRINT\r\n"); // tells printer to print what you just told
it
myPrinter.Write("\f"); // formfeed

On the printers I've worked with, instead of a formfeed character, I just
write out however many lines of CR/LF I need to advance the paper as much as
I want. I also have found that it's often necessary to delay closing the
port until the printer has had a chance to print by calling
Thread.Sleep(100) or some such value. I've also worked with printers that
needed a Thread.Sleep(100) or something after each line sent to the printer
to get them to work properly.

HTH,
 
Hi everybody,

I'm working on this project to send print jobs to the printer. I had
opened the port and I tried sending data over such as text like
“Hello World” but the printer refused to print. The light flickers

Which "port"? The Virtual Serial/COM port? If so, I don't think
that'll work; the printer likely uses IrLPT alone. So, see the solution
at the very end of this thread,
http://groups.google.co.uk/group/mi...=alanjmcf+zebra&rnum=1&hl=en#2265cb60f1541d5d
Which results in the sample at
http://www.alanjmcf.me.uk/comms/infrared/irdaDotNetCliIrLpt.cs.html
and beeped for a second. The problem now is that whether I’m sending
the right information over. My printer is a Zebra QL420 Mobile
Printer. I tried sending CPCL printer language but still it doesn’t
print out. According to some threads, I have to add CR, LF and FF to
it, but the question now is how do I set the format to send to the
printer or how do I add the CR/LF/FF to it to have the different new
line? Your help is deeply appreciated.
Further to Ginny's response, if you are using VB.NET rather that C#, use
ControlChars.CrLf etc (Microsoft.VisualBasic.ControlChars), or vbCrLf
etc. See my second sample for usage,
http://www.alanjmcf.me.uk/comms/infrared/irdaDotNetCliIrComm.vb.html
 
Alan,

That does look promising. I don't have any IrDA printers to test it with
however.
 
Hi Ginny & Alan,

Thank you for your replies.

For Ginny:
I tried your method but couldn't work. The stubborn printer still refueses to
print.

For Alan:
what do you mean by Virtual Serial/COM port? I'm using infrared Port 3 of the
Symbol PPT8846 Win CE 4.2. I had compiled your C# sample but i tried loading
it into my PPT but couldn't work. Pardon me, i'm very new to C# and also
infrared printing.

Ian

Hi everybody,

I'm working on this project to send print jobs to the printer. I had
opened the port and I tried sending data over such as text like
“Hello World” but the printer refused to print. The light flickers

Which "port"? The Virtual Serial/COM port? If so, I don't think
that'll work; the printer likely uses IrLPT alone. So, see the solution
at the very end of this thread,
http://groups.google.co.uk/group/mi...=alanjmcf+zebra&rnum=1&hl=en#2265cb60f1541d5d
Which results in the sample at
http://www.alanjmcf.me.uk/comms/infrared/irdaDotNetCliIrLpt.cs.html
and beeped for a second. The problem now is that whether I’m sending
the right information over. My printer is a Zebra QL420 Mobile
[quoted text clipped - 3 lines]
printer or how do I add the CR/LF/FF to it to have the different new
line? Your help is deeply appreciated.

Further to Ginny's response, if you are using VB.NET rather that C#, use
ControlChars.CrLf etc (Microsoft.VisualBasic.ControlChars), or vbCrLf
etc. See my second sample for usage,
http://www.alanjmcf.me.uk/comms/infrared/irdaDotNetCliIrComm.vb.html
Below are the sample CPCL codes:
[quoted text clipped - 3 lines]
 
Hi Alan,

Sorry for my previous post. I run the program and the PPT8846 connects to the
printer but couldnt print. What could have been the problem ?

Ian
Hi Ginny & Alan,

Thank you for your replies.

For Ginny:
I tried your method but couldn't work. The stubborn printer still refueses to
print.

For Alan:
what do you mean by Virtual Serial/COM port? I'm using infrared Port 3 of the
Symbol PPT8846 Win CE 4.2. I had compiled your C# sample but i tried loading
it into my PPT but couldn't work. Pardon me, i'm very new to C# and also
infrared printing.

Ian
[quoted text clipped - 24 lines]
[quoted text clipped - 3 lines]
 
In said:
Hi Alan,

Sorry for my previous post. I run the program and the PPT8846
connects to the printer but couldnt print. What could have been the
problem ?
Hmm... If the connect succeed then it suggests that the printer is
ready and waiting to receive the print job, so I don't know... Reboot
both and try again (a previous correspondent noted that he had problems
with new code until he rebooted his PocketPC, he assumed that all his
various previous testing had got the protocol stack in a mess...)
Otherwise see if any of Ginny's suggestions help.
 
Hi Alan,

It seems that the PPT8846 could connect to the printer and the light flickers
when I sent bytes over. Could it be the printer’s problem? I had tried
different handshake methods using Ginny codes but still can’t get it work.

Regards,
Ian
 
Ian,

Did you also try Sleep(1000) after each line of output? If that doesn't do
the trick, I really don't know what to suggest since I don't have any IrDA
printers to test with. I just got in a new Bluetooth Zebra printer I'll be
working with today.
 
Hi Ginny,

Yup. I placed it after every output and i even placed it everywhere; after
opening and before closing. Well, the sleep doesnt seems to work. I'm
currently using the OpenNetCF assemblies and gotten some bit and pieces ot
codes from different forums. I'm still very confused regarding what
handshakes is suppose to use in my context.

Regards,
Ian
Ian,

Did you also try Sleep(1000) after each line of output? If that doesn't do
the trick, I really don't know what to suggest since I don't have any IrDA
printers to test with. I just got in a new Bluetooth Zebra printer I'll be
working with today.
[quoted text clipped - 18 lines]
 
Back
Top