Problem with custom MemoryStream and AddFileField

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
lebateleur
Posts: 2
Joined: Fri Oct 21, 2011 6:16 am

Problem with custom MemoryStream and AddFileField

Post by lebateleur »

Due to a customer requirement to be able to scan in 8bpp with any kind of scanner I am using your software to get a multipage PDF with 24bpp images on it. Then I use a selfmade ActiveX to convert all images to 8bpp.
There is nothing wrong with my ActiveX, I can even save to disk the resultant memory stream and it is OK. But when I send the resultant memory stream to the server using AddFileField I get "Class doesn't support Automation".

What should I do?
I'm starting to think you are receiving a somehow modified System.IO.MemoryStream object. Is that correct?


Thank you
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: Problem with custom MemoryStream and AddFileField

Post by Alex »

Hello,
I'm starting to think you are receiving a somehow modified System.IO.MemoryStream object. Is that correct?
No, SDK returns "not modified" System.IO.MemoryStream object.

... I get "Class doesn't support Automation".
How do you use VintaSoftTwain.NET SDK? SDK is a .NET component, not ActiveX control.

Best regards, Alexander
lebateleur
Posts: 2
Joined: Fri Oct 21, 2011 6:16 am

Re: Problem with custom MemoryStream and AddFileField

Post by lebateleur »

Dear Alexander,

First I create an object:

<object id="enviohttp" width="1" height="1" classid="<% Response.Write(Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/"))); %>/Vintasoft.Twain.dll#Vintasoft.Http.HttpUpload" codebase="<% Response.Write(Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/"))); %>/Vintasoft.Twain.dll#version=7,1,7,3">

Then I have a javascript function to send the scanned images to the server:

<% Response.Write(Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/"))); %>

function EnviaraServer(imagen,n,cl,tk) {
if (enviohttp.ProxyPort == null) {
alert("blah blah");
return;
}
try {
enviohttp.Url = "<% Response.Write(Session["url"]); %>";
enviohttp.CookieHeader = document.cookie;
enviohttp.UseDefaultCredentials = true;
var obj = new ActiveXObject("EasyCloudCOM.Convertir");
imagen = obj.ToPDF8BPP(imagen);
obj.SavePDF(imagen);
alert(''til here is OK');
enviohttp.AddFileField("file",cl + ":" + tk + ":" + n + ".pdf", imagen);
alert('it never gets here');
...


If I remove my activeX it works fine, but I do not understand why.
To be sure that I do not generate a corrupt memorystream I made a new method called "SavePDF" which succesfully writes the memory stream to disk just before calling AddFileField method.

I'm a bit lost here, any help will be appreciated.
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: Problem with custom MemoryStream and AddFileField

Post by Alex »

Hello,

Could you send us a working application which demonstrates your problem?

Best regards, Alexander
Post Reply