I'm implementing the scanning functionality to our OutSystems web application and to accomplish this we are using the VintaSoft Twain ActiveX v188.8.131.52. I'm at the point of sending the scanned images to the server for storage. The part of scanning and previewing the scanned images is already done and it works. The issue I'm having right now is the following:
The VintaSoft ActiveX gives you only the possibility to upload each scanned file ( as.. pdf, Tiff, JPEG, BMP or PNG) separately to the server through the HTTP upload functionality. I'm uploading each image as PDF.
In outsystems in the preparation of the page which is receiving the Http upload, it stores each image as a binary in a recordlist. I'm at the point that I want to iterate through this record list and add all those images ( binaries) together in one PDF document.
Do one of you have done this? or can you point me in the right direction to accomplish this?
Or maybe is there a way that I can add JPEG, TIFF to a PDF multipage file also. Then I will send the images in the required format and add them all together to a single pdf file.
I found the following extension:http://www.outsystems.com/forge/component/466/iTextSharp/
I tried to use it, but when it comes to the part to merge all the pdfs I'm getting the following error:
 PDF header signature not found. at iTextSharp.text.pdf.PRTokeniser.CheckPdfHeader() at iTextSharp.text.pdf.PdfReader.ReadPdf() at OutSystems.NssiTextSharp.CssiTextSharp.MssMergePDF_Bulk(RLPDFRecordList ssPDF_List, Byte& ssMergedPDF)
I have posted this in the discussion board of the extension also, to see if someone following the extension or the creator may give me some guidance or shed some light on the issue.
I let the HTTP request save each file in a table just to check the PDFs and I noticed that from the 3 pages scanned the last 2 are corrupted. So I think that is the issue..
I decided to post the solution to my problem in case someone gets into the same situation.
When sending files to the Webserver through HTTP Post (Upload) via a webpage, make sure the name is unique, otherwise only the first file will be good and the rest will be corrupted.
When you check the raw content with the GetRequestContent the form data name you send in the HTTP post per file must be unique:
Content-Disposition: form-data; name="Image0"; filename="Image0.PDF"Content-Type: application/octet-streamContent-Transfer-Encod ing: binary
The name="......." , must be unique for each file you are sending.
I was implementing the scanning functionality into a web application with the VintaSoft twain scanning component to send the scanned images to the web application for storage and encountered this issue while doing a HTTP upload, I was assigning for each uploaded file the same name ('file'), now that I assign each file a unique name all pdf files are readable and the Merging with the ITextSharp extention works like a charm.
To elaborate more on this issue, and the solution, the support staff of the ActiveX stated that this is an issue with Outsystems or my code, because the name in the HTTP post is informational and shouldn't be an issue if you send the same description for the name. My code is pretty straight forward I just take the files coming from the HTTP request through the GetRequestFile function that resides in the HTTPRequestHandler extention and I store them into the database.