Hi Danijel,
the easiest way:
-----------------------------------------------------------------------------
LOCAL siHandle AS PTR
siHandle := FOpen("LPT2.DOS",FO_WRITE)
FWriteLine(siHandle,"Whatever you want")
FClose(siHandle)
-----------------------------------------------------------------------------
Slightly sophisticated: 8-))
-----------------------------------------------------------------------------
LOCAL siHandle AS PTR
LOCAL oPrint AS StampaRTF
LOCAL crlf AS STRING
LOCAL oPrinter AS PrintingDevice
crlf := _chr(13)+_chr(10)
oDCRichEdit1:TextValue := PadC("Anagrafica Socio
"+AllTrim(SELF:Server:Nome),78)+crlf
oDCRichEdit1:TextValue += "Whatever else"+crlf
oDCRichEdit1:ReadOnly := TRUE
siHandle := FCreate("TEMP.TXT")
FWriteLine(siHandle,oDCRichEdit1:TextValue)
* FWriteLine(siHandle, CHR(12))
FClose(siHandle)
oPrinter := PrintingDevice{}
oPrinter:Setup()
oPrint := StampaRTF{"Stampa Anagrafica Socio",oPrinter}
IF !oPrint:IsValid()
TextBox{SELF,"WARNING","Printer not ready !"}:Show()
oPrint:Destroy()
ELSE
oFont := Font{FONTROMAN12}
oPrint:Font := oFont
oPrint:Font:PitchFixed := TRUE
oPrint:Start()
oPrint:Destroy()
ENDIF
FErase("TEMP.TXT")
GLOBAL position AS LONGINT
GLOBAL alreadyopen AS LOGIC
CLASS StampaRTF INHERIT Printer
EX****T oPrintOwner AS VideoRTF
METHOD Init(cJobName, oPrintingDevice) CLASS StampaRTF
SUPER:Init(cJobName, oPrintingDevice)
RETURN SELF
METHOD PrinterExpose(OPEE) CLASS StampaRTF
LOCAL xpos AS INT
LOCAL ypos AS INT
LOCAL nHeight AS INT
LOCAL nCur_Y_pos AS INT
LOCAL oTextSize AS OBJECT
LOCAL oCanvas AS OBJECT
LOCAL siHandle AS PTR
LOCAL cBuffer AS STRING
siHandle := FOpen("temp.txt",FO_READ)
IF !alreadyopen
position := FSeek(siHandle,0)
alreadyopen := TRUE
ELSE
position := FSeek(siHandle,position)
ENDIF
xpos := 5
ypos := 0
oCanvas := SELF:CanvasArea
nCur_Y_pos := oCanvas:Height
DO WHILE !FEof(siHandle)
cBuffer := FReadLine(siHandle)
position := FSeek(siHandle,0,FS_RELATIVE)
IF (CHR(12) $ cbuffer)
FClose(siHandle)
RETURN TRUE
ELSE
oTextSize := SELF:SizeText(cBuffer)
nHeight := (oTextSize:Height + 2)
ypos := nCur_Y_pos - nHeight
SELF:TextPrint(cBuffer, point{xpos, ypos})
nCur_Y_pos := ypos
IF nCur_Y_pos <= 0
FClose(siHandle)
RETURN TRUE
ENDIF
ENDIF
ENDDO
FClose(siHandle)
alreadyopen := FALSE
RETURN FALSE // Nothing more to print
-----------------------------------------------------------------------------
HTH,
Francesco
<danijel.koprivnjak@[EMAIL PROTECTED]
> ha scritto nel messaggio
news:e84820e0-0f50-4f81-bc26-d558fe01c7cc@[EMAIL PROTECTED]
> Hi !
>
> does anybody know how I can put text on serial printer from my app.
> When use FCOPY() I get strange characters like upside down query.
>
> thx
> Danijel Koprivnjak


|