Print text file

BlitzPlus Forums/BlitzPlus Programming/Print text file

Starwar(Posted 2007) [#1]
hiho. Iīm not sure where to post this, so itīs here now.

So. I programmed this litte code to print textfiles (.txt).
Has anybody a way to print docs like Images or formated texts?

Thanks.

Hereīs the code:

Function printtextfile (file$,Notifyerror%,notifyok%)
;This Function use notepad.exe (Editor). All setting of Editor wil e used (Font, Style, etc.)
;Supported Format: .txt
;file$ = File to Print
;notifyerror% = Show nofify if file couldnīt be printed (1 = on ; 0 = off)
;notifyok% = Show notify when all is ok ;) (1 = on ; 0 = off)
printfile = OpenFile (file$)
If printfile = 0 Then
If notifyerror% <> 1 Then Return 0
If notifyerror% = 1 Then Notify "Unable to open file",1 : Return 0
EndIf
CloseFile printfile
exepfile$ = "notepad.exe /p " + file$
pef% = ExecFile (exepfile$)
If pef% = 0 Then
If Notifyerror% <> 1 Then Return 0
If notifyerror% = 1 Then Notify "Unable to start printing" : Return 0
EndIf
If notifyok% = 1 Then Notify "Printing file..."
Return 1
End Function