` Comment on an Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Add a comment to an Icetips Article

Please add your comments to this article. Please note that you must provide both a name and a valid email address in order for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!

Your Name:  
Email:  
Header text/Subject:  

Please enter your comment in the box below:

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Using Jim Kane's Print Class with receipt printer
2004-11-18 -- Greg Sayler
 
For anyone interested in how to use jim Kane's print class to print to a receipt printer here is what I did... RetVal BYTE(0) C1 STRING(100) C2 STRING(100) C1Width BYTE C2Width BYTE WordStart LONG WordEnd LONG Text1 CSTRING(1000) MyPrinterDialog LONG MyPrinterFF LONG PrintDataAddr LONG PrintDataLen LONG EnumPtrcl EnumPrtClType ReceiptQ QUEUE,PRE(ReceiptQ) Line CSTRING(100) END Window WINDOW,AT(,,300,23),CENTER,GRAY STRING('Printing Receipt....'),AT(120,6),USE(?String1),FONT(,,COLOR:Red,,CHARSET:ANSI) TEXT,AT(70,14,160,8),USE(Text1),BOXED,HIDE,FONT('Courier',,,,CHARSET:ANSI) END CODE LOOP IF GEN:ReceiptPrinter = '' OR ~GEN:ReceiptPrinterCols MESSAGE('Receipt Printer Not Setup!') SetupForm CYCLE END BREAK END EnumPtrCl.Init() MyPrinterDialog = 0 MyPrinterFF = 0 OPEN(Window) C1Width = GEN:ReceiptPrinterCols - 12 C2Width = GEN:ReceiptPrinterCols - C1Width ?Text1{Prop:Width} = GEN:ReceiptPrinterCols * 4 + 1 ?Text1{Prop:Text} = GEN:ReceiptMessage DISPLAY ReceiptQ:Line = CENTER('Store Number: ' & GEN:StoreNumber,GEN:ReceiptPrinterCols) DO AddReceiptQ !Add any more lines needed here !This is how I format for Item followed by an amount C1 = RIGHT('Gift Card Number:',C1Width) C2 = RIGHT(GIH:GiftCertNumber,C2Width) ReceiptQ:Line = CLIP(C1) & CLIP(C2) DO AddReceiptQ !Add receipt text from setup file LOOP i# = 1 TO ?Text1{Prop:LineCount} ReceiptQ:Line = ?Text1{Prop:Line,i#} DO AddReceiptQ END !Add blank lines required to force receipt to tear off LOOP GEN:ReceiptPrinterBlankLines TIMES ReceiptQ:Line = ' ' DO AddReceiptQ END LOOP x# = 1 TO RECORDS(ReceiptQ) GET(ReceiptQ, x#) IF ERRORCODE() THEN STOP(ERROR()). PrintDataAddr = ADDRESS(ReceiptQ:Line) PrintDataLen = LEN(CLIP(ReceiptQ:Line)) EnumPTrcl.DirectPrtBlock(MyPrinterDialog,GEN:ReceiptPrinter,PrintDataAddr,PrintDataLen,MyPrinterFF) END!Loop DO ProcedureReturn AddReceiptQ ROUTINE !Need FF if less than printers full col length IF LEN(CLIP(ReceiptQ:Line)) < GEN:ReceiptPrinterCols ReceiptQ:Line = ReceiptQ:Line & '<13,10>' END ADD(ReceiptQ) ProcedureReturn ROUTINE Enumptrcl.Kill() FREE(ReceiptQ) RETURN(RetVal)


Today is November 23, 2024, 2:04 am
This article has been viewed 35235 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: