I needed to use a modified rPreview anyway to support my email options. I simply have a user set flag that allows them to use Image2PDF ( which I do have a license for and it's already on their computers ). In the SendEMail( ) option, I simply redirect the PDF build to the alternate method, and then attach it to the email. My email system is also different because I need to support SMTP, CDO ( SSL ), and MAPI.
Now if I could specify in the Main( ) program an alternative to the SendEMail method contained in rpreview ( as your were doing with the PDF ), then it would be great because I could then use the rpreview without modification. Here is what I have for the SendMail( ) method now:
METHOD SendEmail() CLASS TPreview
local oMail, cName, cFile, cSendTo, aInfo
IF lUseOldXP
PrevEmail( ::oDevice:aMeta )
ELSE
cSendTo := IIF( ! EMPTY( cDefEml), cDefEml, SPACE(100) )
cName := If( ::oReport != nil, ::oReport:cName, ::oDevice:cDocument )
cFile := cFilePath( ::oDevice:aMeta[ 1 ] ) + StrTran( cName, '.', '' ) + ;
Left( HB_TToS( HB_DateTime() ), 14 ) + ".pdf"
CursorWait()
cFile := ::SaveAs( .t., cFile, .f. ) // This is the problem area
CursorArrow()
if ! File( cFile )
MsgInfo( FWString( "PDF not saved to send Email" ), FWString( "Information" ) )
elseif ::bEmail != nil
Eval( ::bEmail, Self, cName, cFile )
else
ASWemail( cSendTo, cFile, cName )
/*
DEFINE MAIL oMail ;
SUBJECT cName ;
TEXT "" ;
FILES cFile, cFile ;
FROM USER
ACTIVATE MAIL oMail
// MsgInfo( oMail:nRetCode ) check the returned code!
*/
endif
ENDIF
::oMeta1:SetFocus()
SysRefresh( )
*/
return nil
PrevEmail is a simple function build a PDF:
FUNCTION PrevEmail( aFiles )
LOCAL cWhoTo := SPACE(255), cFileToSend
// Create the PDF to attach to the file
cFileToSend := BuildPDF( aFiles )
cSubject := "Your requested report"
// Now do the transmission
ASWemail( cWhoto, cFileToSend, cSubject )
RETURN NIL
And BuildPDF is the code for Image2PDF.