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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

printer driver/ printer liba

Status
Not open for further replies.

engan

Programmer
Jul 15, 2001
53
ID
Hi,
I need to print my report to any printer (Laser/Dot Matrix any brand) is there any printer driver/library/utility out there so that I dont have to put the printer control code manually. What I want is just issue @PROW() .... then the driver/library will take over automatically.
 
If you are only concerned about the basic printer commands like print compress, bold, underline or landscape/portrait setting, you could do what I did. Set up a function that you would pass a printer type (1=dot matrix, 2=laser) and it would then put the contol codes in your report.
I know it means hardcoding the printer controls, but you would only have to do it once. If you need some examples, let me know.
 
hi Elkari, what I need is my program will work on any printer laser/dot matrix any brand, that way I dont have to buy each printer to test my program. I have done what you have suggested but only using epson dot matrix and hp printer, but I can't find control codes for printer cannon, epson stylus etc.
 
I have codes for printers laser and dot printers.
send me a mail and i send to you.

just use like next:

? chr(27)+.... ///code printer

ramonzea@hotmail.com
ramonzea@yahoo.com
 
you try on this:

Function rFont(cType, nPar1)
Local __nf := 0
Local aSets := {}
If ( !lPrinting )
Return ( "" )
EndIf
Do Case
Case ( cPrinter == "DirectPrint" )
Return ( Nil )
Case ( cPrinter == "EpsonPVt88" )
//para epson t88p p.vta. t‚rmico
aSets := { {"Normal", Chr(8)},;
{"Comprimido", Chr(15)},;
{"Expandido", Chr(14)},;
{"AltoDoble", CHR(27) + "!" + CHR(27) + Chr(0)},;
{"AltoNormal", CHR(27) + "­" + CHR(27) + Chr(64)},;
{"Cancelar", CHR(64) + "­" + CHR(27) + Chr(64)},;
{"Cortador", Chr(27) + 'i'} ;
}
Case ( cPrinter == "IBMProPrinter" )
//para epson t88p p.vta. t‚rmico
aSets := { {"Normal", Chr(18)},;
{"10Cpi", Chr(18)},;
{"Comprimido", Chr(15)},;
{"Expandido", Chr(14)},;
{"AltoDoble", CHR(27) + "!" + CHR(27) + Chr(0)},;
{"AltoNormal", CHR(27) + "­" + CHR(27) + Chr(64)},;
{"Cancelar", CHR(64) + "­" + CHR(27) + Chr(64)},;
{"Cortador", Chr(27) + 'i'} ;
}
Case ( cPrinter == "HPLaser" )
aSets := { {"Normal", "&k0S" },;
{"Comprimido", "&k2S" },;
{"Expandido", Chr(14)},;
{"SubrayadoOn", CHR(27) + "&dD"},;
{"SubrayadoOff",CHR(27) + "&d@"},;
{"AltoDoble", CHR(27) + "!" + CHR(27) + Chr(0)},;
{"#Copias", CHR(27) + "&l1X"},;
{"Test", CHR(27) + "z" },;
{"Cancelar", Chr(27) + 'E'} ;
}
EndCase
If ( (__nf := aScan(aSets, {|f| f[1] == cType})) <> 0 )
QQOut(aSets[__nf][2])
End
Return ( &quot;&quot; )

L.I.A. Ramon Zea

ramonzea@hotmail.com
 
Have a look at Look for printer.zip or printer2.zip. There should be a DBF file with LOTs of printers and the escape sequences. In your program, you load this table, ask the user to select which printer he-s using and just copy the ESC codes to variables... As easy as that.
While you're there, you may have a look at other progrs/utils they have...
Database is not updated but you get the idea. Also you don't need to BUY each printer. You may look on the internet if the printer your user supports PCL, etc and just use a generic printer which should use almost the same coeds (if not the same).
Good luck,
Sergio Terenas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top