I have a secondary Web Services data source in my form. One field contains PDF images. When I search for and return a record, I wish to display (preview) the PDF in the form. I tried adding the Adobe PDF Reader ActiveX but don't know how to pass the PDF binary data from the web service to it.
I can get the record, I can return all the other fields correctly. I can even write out the PDF binary to a file. What I can't figure out is how to display the PDF as an image in the form. I want the users to be able to see the PDF image inline with the metadata for that PDF.
Am I going down the wrong path? Is there an easier way?
**********************************************************************************************************************************************************************
Dim xpathFC As String = "/dfs:myFields/dfs:dataFields/tns:FetchManyResponse/docs/fileContent"
Dim nav1 As XPathNavigator = Me.DataSources("fetchMany").CreateNavigator() 'Me.DataSources("FetchManyResponse/docs/fileContent").CreateNavigator()
Dim FileContent1 As String = nav1.SelectSingleNode(xpathFC, NamespaceManager).Value
Dim xpathPDF As String = "/my:myLocalFields/my:ImagePDF"
Dim nav3 As XPathNavigator = Me.MainDataSource.CreateNavigator()
Dim FileContent3 As String = nav3.SelectSingleNode(xpathPDF, NamespaceManager).Value
' File Name
Dim time As String = DateTime.Now.ToString("ddMMyyyyhhmmss")
Dim fileName As String = "File" + time
Dim data As Byte() = Convert.FromBase64String(FileContent1)
' Write the file
Dim outfile As System.IO.FileStream
outfile = New System.IO.FileStream("C:\temp\temp\" + fileName + ".pdf", System.IO.FileMode.Create, System.IO.FileAccess.Write)
outfile.Write(data, 0, data.Length - 1)
outfile.Close()
'Write to Form
DeleteNil(nav3)
'Cannot run - Gets "Value of type '1-dimensional array of Byte' cannot be converted to 'String'. "
'nav3.SelectSingleNode(xpathPDF, NamespaceManager).SetValue(data)
'Fails - gets "Schema validation found non-data type errors."
'nav3.SelectSingleNode(xpathPDF, NamespaceManager).SetValue(FileContent1)