I have a question about using .KIT in a web service. Maybe you can point me to an example. Basically, I would like to return the file as binary file type.
The current example that I have seen from you returns the file as a Response.OutputStream. I will not be using the HTTP response on the web service since I will return the file to the client as a binary file.
To start, I would like to know the best method to create a binary file Dim outputFilestream As Stream = New FileStream(templatePdf, FileMode.Open, FileAccess.ReadWrite)
Dim inputString As String = Server.MapPath(“folder\Name.pdf”)
form = New Form(inputString, outputFilestream) ’ I then fill the form fields For i = 0 To 5 form.FillField(fieldNameArray(i), fieldValueArray(i)) Next ’ Then I try to create a byte file from the stream Dim len As Integer = CType(outputFilestream.Length, Integer) mByteArray = New Byte(len - 1) {} outputFilestream.Read(mByteArray, 0, len) ’ It fails here!! It would be great if I could have a byte type file returned directly from one of your methods instead of a file stream.
You have to call the Save method of Form class after filling all the fields and reset the filestream pointer to 0 [Seek(0, SeekOrigin.Begin)] before reading it into an array.