Quantcast
Channel: FiveTech Software tech support forums
Viewing all articles
Browse latest Browse all 26212

class tprinter and a dot-matrix printer

$
0
0
A customer of mine is using a old matrix-printer to print labels Have a look at [color=#0000FF:2tz1srb6]TDOSPRN [/color:2tz1srb6]( source ) The following code will let you print directly to the printer from inside any Fivewin program, like OLD DOS days. Those users that need DOS printing speed can use this class instead of the TPrinter class. This is a little sample of how to use the new class: LOCAL oPrn oPrn := TDosPrn():New("lpt1") oPrn:StartPage() // optional oPrn:Say(10,20, "This goes in line 10, column 20") oPrn:EndPage() // optional oPrn:End() A little description of all the members of this class: DATAs: cPort: Printing port, by default "LPT1" cCompress: String for compressed mode, by default "15" cNormal: String for normal mode, by default "18" cFormFeed: String for EJECT, by default "12" hDC: Printing file Handle (Internal use) nRow: Current printing row nCol: Current pringing column nLeftMargin: Left margin, by default 0 nTopMargin: Top margin, by default 0 lAnsiToOem: If .T. a Ansi to Oem translation is done automatically whe printing, by default is .T. METHODS: New(cPort) Constructor, no comment End() Destructor, no comment StartPage() Begining of a page, this method is optional EndPage() End of page, this method is optional if there is only one page Command(c) Let you send any command to the printer without changing the current row and col. The string to pass as a parameter should content the ascii values of the command separated with commas, for example, the command to reset Epson printers should be: "27,69" SetCoors(r,c) Let you change the current row and col is the equivalent of SetPrc() of Ca-Clipper NewLine() Increments the current row Write(cText) Prints the string cText in the current row and column Say(nRow ,; Prints the string cText in nRow, nCol nCol ,; lAtoO indicates if the string should be transformed to Oem, cText ,; by default is ::lAnsiToOem lAtoO ) SayCmp() The same as the method Say but prints in compressed mode and the row is updated accordly. NOTE: If you try to print on a row before the current one a EJECT will be done automatically. At the end of this class is a little function call WorkSheet that will make the job of DOS printing a lot easier. LKM changed behavior of how EJECT is handled, for real DOS simulation In the same way if you try to print on the same row as the current, but in a previous column from the current one a EJECT will be done automatically TIP: make sure port name (\sharename part) is 8 chars or less, or you'll get a DOS error 5 (Access denied) if printing across the network [code=fw:2tz1srb6][/code:2tz1srb6] regards Uwe

Viewing all articles
Browse latest Browse all 26212

Trending Articles