Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Print frx to ticket printer
Message
De
01/10/2003 05:28:11
 
 
À
30/09/2003 11:17:17
Norman Avila
Universal Computadora Guatemala, S.A.
Guatemala, Guatemala
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00833504
Message ID:
00833738
Vues:
23
Hi Norman,

We use a mixed solution:

1. Report form MyReport to file MyFile.txt ASCII
2. Open the file (filetostr() or fopen())
3. Send each line to the printer (either with OPOS or direct to serial port with MSCOMM)

This has the advantage to :
- having a normal FRX report: easy for the user to change layout, call any VFP functions, etc.
- be compatible with all ticket printers
- be very quick
- lets you control how many lines before and after the file are sent
- send a paper cut command when you want

Disadvantages:
- Text properties are lost (Bold, Italic, Font, etc.)
*--------------------------------------------------------
* Example
*--------------------------------------------------------
*/DT/ Sends the file to the POS printer
lparameters lcFileName
if file(lcFileName)	
	local lcLine, lnCount, lnReceiptFooter
	lnReceiptFooter = 5
	
	dimension laLines(1)
	if alines(laLines, filetostr(lcFileName)) > 0 
		lnCount = alen(laLines, 1)

		*/DT/ Delete empty lines at the bottom of the report
		lcLine = laLines(lnCount)
		do while empty(lcLine)	
			lnCount = max(1, lnCount - 1)
			lcLine = laLines(lnCount)
		enddo
		dimension laLines(lnCount + 1, 1)
				
		*/DT/ Sends each line to the printer
		this.printerinit && <-- OPOS or serial
		for lnCount = 1 to alen(laLines, 1)
			this.printerlineprint(laLines(lnCount)) && <-- This is our own print method (either OPOS or Serial)
		endfor
		this.printerlinefeed(lnReceiptFooter) && <-- OPOS or serial
		this.printercutpaper && <-- OPOS or serial
	endif
else
	devalert([Cant' locate file] + ' ' + lcFileName)
endif
	
Gensoft Sàrl
Christian Carron
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform