Dumping print data to a parallel port thermal printer for printing

Hi Experts,
I need urgent help on a problem i am facing.
I am developing an application that generates shipping  transactions using fedex webservices.The transactions are generated but it returns the shipping lablels having barcodes, address etc, & saves it  as a text file .I need to print these labels on a thermal printer (ZEBRA attached to LPT1 port).The saved text file seems to be a set of printer commands.
My problem is :
I need to send this file to the parallel port e.g.LPT1  which has a thermal printer on it, in order to print it programatically using VB.NET or VB. Can anyone help me ?

The partial contents of saved labels file  are as below:
^XA^CF,0,0,0^PR12^MD30^PW800^PON
^FO0,147^GB800,4,4^FS
^FO0,401^GB800,4,4^FS
^FO0,746^GB800,4,4^FS
^FO35,12^AdN,0,0^FWN^FH^FDFrom:^FS
^FO35,31^AdN,0,0^FWN^FH^FDRobert Climp^FS
^FO35,51^AdN,0,0^FWN^FH^FDMicro Corporation^FS
^FO35,71^AdN,0,0^FWN^FH^FD256 VIRGIN STREET^FS
^FO35,92^AdN,0,0^FWN^FH^FD^FS
^FO35,112^AdN,0,0^FWN^FH^FDMary Land, TX 77479^FS
^FO35,132^AdN,0,0^FWN^FH^FD(713)203-2500^FS
^FO490,31^AdN,0,0^FWN^FH^FDShip Date: 31MAR06^FS
calorisplanitiaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PockyMasterCommented:
You have some options, one of that it call a dos command to copy the content of your file to the LPT1 :D
That's the easiest,

another is use API's to create the printer connection and do it that way.
0
PockyMasterCommented:
I wasn't able to test it (have no printer on LPT1) but I guess it should work.

 Private Sub PrintFile(ByVal FileName As String)
        Dim si As New ProcessStartInfo()

        With si
            .FileName = System.Environment.GetEnvironmentVariable("COMSPEC")
            .Arguments = String.Format("/C print /D:LPT1 {0}", FileName)
            .UseShellExecute = False
            .CreateNoWindow = True

        End With

 Process.Start(si)

End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
calorisplanitiaAuthor Commented:
thanks for the promt reply
I will test it & let you know
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

calorisplanitiaAuthor Commented:
I have tried using the following but it doesnt do anything

PrintFile("c:/labels/label.txt")

Private Sub PrintFile(ByVal FileName As String)
        Dim si As New ProcessStartInfo()

        With si
            .FileName = System.Environment.GetEnvironmentVariable("COMSPEC")
            .Arguments = String.Format("/C print /D:LPT1 {0}", FileName)
            .UseShellExecute = False
            .CreateNoWindow = True

        End With

 Process.Start(si)

End Sub
0
PockyMasterCommented:
And if you type the command in a console in windows
print /D:LPT1 c:\labels\label.txt

does it print?
0
calorisplanitiaAuthor Commented:
the command promnt says
C:\labels\label.txt is currently being printed

but as iam running this through remote desktop on remote server i cannot actually see whether its really printing or not,but the printer que doesnt show anything or any file qued

maybe its printing, i need to check that

0
PockyMasterCommented:
if the printer is shared via network you also can try :
Copy c:\labels\label.txt \\WhatEverShare\YourPrinter

I used this one a couple of weeks ago (also on a Zebra printer)
0
calorisplanitiaAuthor Commented:
i think its working ....
things will be clear after i do some more tests
0
calorisplanitiaAuthor Commented:
thank you very much for the promt solution.
It works fine.
Problem solved!

Next thing is to develop it to work on asp.net webpage so that it print on server, which i think will work with you solution.
I have acceptyed your answer.
0
PockyMasterCommented:
Ok, Have fun!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.