LotusScript FileExists Function

The DominoPDF DoPDF() method returns 0 (zero) for a successful operation and -1 for an unsuccesful operation.

So you can take the return value and test against this, for example;

iRet = DoPDF(sURL, sPDF, sOptions)
if iRet = -1 then Error = True

You can also use the LotusScript Dir$ function to check that the PDF has actually been created on disk and if not take appropriate action.

To make it even easier below is a FileExists() LotusScript method which you can use.

Function FileExists(sFileName As String) As Integer
'Declare variables..
Dim iPos As Integer, iPrevPos As Integer
Dim sFile As String

'Validate passed filename...
iPos = 0
Do
iPrevPos = iPos
iPos = Instr(iPos + 1, sFileName, "\")
Loop Until iPos = 0
iPos = iPrevPos

sFile = Right$(sFileName, Len(sFileName) - iPos)

'Check to see if file exists and return results...
If Dir$(sFileName) = sFile Then
FileExists = True
Else
FileExists = False
End If
End Function

JoomShaper