I am using twain ActiveX component to acquire images from ADF scanner, I want to upload each page as a separate file throw HTTP, I tried the following code (similar to the code of the html example shipped with the component):
Code: Select all
// Acquire
function acquireTWAINAdf(TwainSetAutoFeed, TwainSetAutoScan, TwainSetHideUI) {
ScannerID = drpSannerList.selectedIndex
Resolution = 50
unlockGdPicture();
closeDocument;
var status;
m_GdPictureImaging.TwainOpenDefaultSource_2(ScannerID);
status = m_GdPictureImaging.GetStat();
if (status == 0) {
m_GdPictureImaging.TwainSetAutoFeed(TwainSetAutoFeed);
m_GdPictureImaging.TwainSetAutoScan(TwainSetAutoScan);
m_GdPictureImaging.TwainSetHideUI(TwainSetHideUI);
m_GdPictureImaging.TwainSetResolution(Resolution);
var ImageID;
var imageCount = 0;
do {
ImageID = m_GdPictureImaging.TwainAcquireToGdPictureImage_2(0);
if (ImageID != 0) {
oGdViewer.DisplayFromGdPictureImage(ImageID);
//************************* Important ***************
URL = 'http://localhost/gdScanFolder/' + ImageID +'.jpg';
var status = m_GdPictureImaging.SaveToHTTP_2(m_NativeImage, 4, 5, URL,'m','m1');
//************************* Important ***************
if (imageCount == 0) {
m_NativeImage = m_GdPictureImaging.TiffCreateMultiPageFromGdPictureImage(ImageID);
//end
alert('end');
}
else {
status = m_GdPictureImaging.TiffAppendPageFromGdPictureImage(m_NativeImage, ImageID);
}
m_GdPictureImaging.ReleaseGdPictureImage(ImageID);
}
else {
status = m_GdPictureImaging.GetStat();
}
imageCount++;
}
while (m_GdPictureImaging.TwainGetState() > 5/*TWAIN_SOURCE_ENABLED*/ && status == 0);
if (status != 0) { //report latest error
alert("error occured during acquisition. status: " + status);
}
if (m_NativeImage != 0) {
oGdViewer.DisplayFromGdPictureImage(m_NativeImage);
onDocumentLoaded();
}
}
else {
alert("error openning TWAIN source. status: " + status);
}
}
var status = m_GdPictureImaging.SaveToHTTP_2(m_NativeImage, 4, 5, URL,'m','m1');
is giving me status=9 (user name=”m”, password=”m1”, windows XP,No domain)
Can you please advise me what the problem is and what is the required actions (IIS configuration, user rights).