My Access 2003 app is calling a Web Service that returns a byte array. The byte array is actually a PDF file (believe Access wants to store it as a variant).
Does anyone have an idea how I can retrieve the document and display it for my end user?
trScott,
Assuming the byte array is the complete PDF document you could cache the array to a temp file and then open the newly created temp file.
You might try something like this:
Code:
Sub CreateFileFromByte(OutputFile As String, WebServiceData As Variant)
Dim intFileNumber As Integer
intFileNumber = FreeFile
Open OutputFile For Binary As #intFileNumber
Put intFileNumber, , WebServiceData
Close #intFileNumber
End Sub
Code:
Sub Test_CreateFileFromByte()
Dim b() As Byte
Dim strPath As String, strFileName As String
'This would be your byte array from the web service
b = "The quick brown fox"
'This creates Output.pdf in the user's TEMP folder
strPath = Environ$("TEMP") & "\"
strFileName = "Output.pdf"
'Create the file
CreateFileFromByte strPath & strFileName, b
End Sub
Hope this helps,
CMP
[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.