Customer wants to have a path to a image or PDF file defined in the spool file and the image or PDF file name defined separately. He wants to search for that file name starting at the defined path to see where it actually resides in the sub-folder structure. Then he wants to insert it into a FormDocs field in his form.

  1. Download and install the RJS File Search API.
  2. If converting the PDF fle to TIFF so it can be inserted into the form they will need to purchase a runtime license for the PDF-TOOLS PDF to Image .dll.
  3. Sample Script to place into FormDocs form:
Dim objFileSearch As object
Dim rtnImagePath As String
Dim ImageName As String
Dim ImagePath As String
Dim tempImagePath As String
Dim rtnPDFConvert As Long

'Create object to RJS File Search API
Set objFileSearch = createobject("RJSFileSearchAPI.RJSFileSearch")

'Search for image file starting at specified base path 
rtnImagePath = objFileSearch.SearchFile(trim(thisform.fields("ImageName").Value),trim(thisform.fields("ImageBasePath").Value))

'If a return string of 52 is returned then
'the base path does not exist and we will
'blank out the 52 return value but we
'can at least trap for it.
If trim(rtnImagePath) = "52" Then
MsgBox "Error" & rtnImagePath & ": Base path " & trim(thisform.fields("ImageBasePath").Value) & " does not exist."
rtnImagePath = ""
'If a blank return string is returned then
'the PDF file does not exist.
ElseIf trim(rtnImagePath) = "" Then
MsgBox "Error" & rtnImagePath & ": File " & trim(thisform.fields("ImageName").Value) & " does not exist."
rtnImagePath = ""
End If

'If the PDF file is found then we will proceed with the PDF to TIFF Conversion
If trim(rtnImagePath) <> "" Then

'Set the TIFF image BitsPerPixel
'1 = Black & White
'8 = Grey Scale
'24 = Color
objFileSearch.BitsPerPixel = 1

'Set the TIFF image DPI
objFileSearch.TIFdpi = 150

'Set the TIFF image rotation
'0 = RotateNone (default) 0 - No Rotation
'1 = RotateAttribute - Rotation of the page attribute
'2 = RotatePortrait - Rotate to portrait
'3 = RotateLandscape - Rotate to landscape
objFileSearch.RotateMode = 1

'Set the temp path for the PDF to be converted to
tempImagePath = "c:\wspeform\tempimage.TIF"

'Run the PDF to TIFF Conversion
'The parms are (InputFile as String, OutputFile as String, DisplayErrorMessages as Long)
rtnPDFConvert = objFileSearch.Convert2TIF(trim(rtnImagePath),trim(tempImagePath),1)

End If

'Check to see if there was any conversion errors
If rtnPDFConvert = 0 and trim(rtnImagePath) <> "" Then
ThisForm.Fields("Image").Value = trim(tempImagePath)
ThisForm.Fields("Image").Value = "NO IMAGE FOUND"
End If

Set objFileSearch = Nothing


Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case