It uses the XbpRtf() class and the Bullzip PDF Printer driver.
Code: Select all
#INCLUDE "dcdialog.CH"
#Pragma Library("ascom10.lib")
FUNCTION Main( cFileName )
LOCAL oRtf, cMemo := '', GetList[0], GetOptions, oPrinter, oBullZip, ;
cOutFile, nChoice := 1
IF Empty(cFileName)
cFileName := DC_PopFile(,,'*.rtf')
ELSEIF Empty(DC_Path(cFileName))
cFileName := DC_CurPath() + '\' + cFileName
ENDIF
IF Empty(cFileName)
QUIT
ENDIF
cOutFile := Strtran(cFileName,'.rtf','.Pdf')
cOutFile := Strtran(cOutFile,'.Rtf','.Pdf')
cOutFile := Strtran(cOutFile,'.RTF','.Pdf')
oBullZip := ActiveXObject():create('Bullzip.PDFPrinterSettings')
oBullZip:SetValue('Output',cOutFile)
oBullZip:SetValue('ShowSaveAs','never')
oBullZip:SetValue('ShowSettings','never')
oBullZip:SetValue('ShowPdf','no')
oBullZip:SetValue('ConfirmOverwrite','no')
oBullZip:SetValue('ShowProgressFinished','no')
oBullZip:SetValue('ShowProgress','no')
oBullZip:WriteSettings()
oPrinter := XbpPrinter():new()
oPrinter:create("Bullzip PDF Printer")
oPrinter:setPrintFile(cOutFile)
@ 0,0 DCRTF ;
OBJECT oRTF ;
SIZE 80,20 ;
VAR cMemo ;
EVAL {|o|o:loadFile(cFileName), ;
o:Print(oPrinter)}
DCGETOPTIONS ;
HIDE ;
RESIZE
DCREAD GUI FIT TITLE 'RTF to PDF' ;
EXIT ;
OPTIONS GetOptions
DCMSGBOX 'File Created: ' + cOutFile ;
BUTTONS {'View PDF File','Exit'} CHOICE @nChoice
IF nChoice == 1
DC_SpawnUrl(cOutFile)
ENDIF
RETURN nil
* --------
PROC appsys ; RETURN