Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing Problem

Status
Not open for further replies.

FederalProgrammer

Programmer
Jul 2, 2003
318
CA
Any idea on how to use .net to print to a POS printer? I am currently able to print to a normal printer using .NET printDocument stuff? How am I gonna print to a POS?!!
Help Please!!

why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
It shouldn't be any different. What problems are you experiencing?
 
Apparently they get a blank paper printed, even though in their print preview (I use a print preview diolog box) they see the text!
They say, the printer doesn't have a deriver and it is parallel (whatever that means)! Basically, they have simply connected the printer to their computer and they've been printing god knows how! (they've been using a very old Dos-based system); They also tell me that, the printer is on their LP1;
I have no idea what is going on! When I use my system to print on any normal installed printer it works... I don't know what the deal is!


why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
to print to an old fashion printer in dos
type {filename} > prn

i think if you open printer dialog
select capture port
print some plain text
select end capture
the printer will print.

dont know how to do all this programically. but if this
is the case it will give you a place to start looking.





if it is to be it's up to me
 
dude, this is totally the case!! Now i remember good old Dos command for printing!!! How the (**&#$%@# am I gonna do this in .NET?!!



why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
ah yeah,
I've seen this code before... I have a real hard time making sence out of it... I am not sure how to call this guy's API Functions! I have turned it into a .dll and am trying to run it from my vb.NET application. The gosh darn pointers though!! I don't know what to do with them!
Have you seen the code? can you make any sence out of it?

why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
if it has pointers then it is called unsafe code and there is no way you can convert them to vb.net.
But I think you should tell the people who own that printer to t least install the generic driver that way their should be no problem printing, or even better install the correct driver. Doing it in DOS will only give you more headaches because it is very printer specific even when it is a postscriptprinter. Because there seem to be different PS versions out there. You shouldn't try and solve every problem programmatically.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
kina a kludge but you could write output to a file and use a .bat file to do the printing (you could even create the whole bat file from code).


also im pretty sure you could set up a generic plain text printer on your machine and capture the port from code.
im on vacation next week maybe ill have time to look it up.




if it is to be it's up to me
 
chrissi, my mistake,
it's not a pointer... apparently, a call by reference in C# is a lot more different than the one in B# ;) (syntatically)
I am starting to understand the code better... However, the code looks for a particular printer using a weird IP address! The printer my clients are using is local to their store!! No network or anything! how can specify location of a printer?

These guys apparently can print MS-word documents no problem... I have no idea what's going on anymore...

How can I print a text-file then? May be I stream all the text to a flat file and print the text from there? How's that done?

infinitelo,
thanx a million dude... I've already missed my deadline... help me out man!!


why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
if you use 127.0.0.1 then you use the local computer.

If word can print you must be able aswell

stream to flat file then do this in a process or shell.

type filename.txt > prn

allthough I must say I tried that in windows XP and it didn't seem to work, but it worked in DOS in the old days.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
filename.txt > prn"
Do u know how I can write the above code in vb.NET? does the "Printing" library provide me with such an option?!


why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
its

"type filename.txt>prn"

it's a command.com command.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Dude, I'm not sure if I know what you mean!!
command.com?
Is this a library? What reference (.dll) do I need to use?

say I have the following function:

Private Sub Print(textToPrint)
'How do I fill in the blank here? (I've been using a print document... apparently that's not what does the magic though)
end Sub









why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
command.com is the program used to open the dos window. it used to be the most important file on your system. it also houses dc, md, dir and other commands.

make a textfile of the text to print and then do this

shell("type fielname.txt>prn") but like I said I'm not sure it will work in xp, I'm pretty sure it will work in 98.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
It sounds like we're getting somewhere....
Ok, they are running 98 or 2000 (had they had XP, we both would be a lot happier!!)
Thanx soooooooooo much dude... I'm gonna try it tonight... will you please keep an eye for me.... I'll update you on the status by tonight 8:00 pm pacific time;

cheers!

why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
chrissie,
I get a file not found error... Here's my code:

dim writer as streamwriter = file.appentText("C:\temp.txt")
writer.write(text)
writer.close

shell("type c:\temp.txt>prn")

do I have replace type by something??
cheers!

why do they call it VB.NET? it's nothing like vb; they should've called it B#!!
 
i dont think file redirection is allowed in shell.
create a .bat file
a text file called printme.bat

rem to print filename.txt to pos printer
type c:\filename.txt > prn



shell("printme.bat")



if it is to be it's up to me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top