Capturesco – The Alfresco Capture Tool (Alfresco Scan)

Capturesco is a tool built using VB.Net to add capture functionality to Alfresco by scanning documents, capture pictures from Web Cams or Camera and Videos. The tool is calling Alfresco Web services and allow the user to choose where to save the scanned or captured images. This tool was tested on Alfresco Lab 3.0 and was build by a help from this great article http://tinyurl.com/cgc984

To use this tool, you must have alfresco lab 3.o installed and configured, currently I am using localhost:8080 and you can change that but you have to rebuild the solution. Also you have to register the WIA.dll using regsvr32

I am using the WIA (Windows Image Acquisition) API to capture or scan documents and images.

Beta 1 from Capturesco was released on Thursday,  the basic functionality are working (capture and choose where to save) but still lots of validations still be made.

To Do for Capturesco 1.0:

  1. Adding validations
  2. Choose the image format
  3. Adding video capture
  4. User Interface enhancement

To do later on after releasing version 1.0

  • Allow adding custom meta data to the scanned or captured image

If you have any ideas or suggestions for features to be added, please feel free to tell me about it.





20 thoughts on “Capturesco – The Alfresco Capture Tool (Alfresco Scan)”

  1. hello
    thanks for this outstanding work. i am interested on working with alfresco. i have downloaded your source code from forge.alfresco.com but i still need a tutorial to make it work. i am a newbee to VB.net because i work only with J2EE.
    please HELP, thanks in advance.

  2. i got error with capturesco:

    “Object reference not set to an instance of an object”
    in this code
    “item = TryCast(WiaDev.Items(1), WIA.Item)”
    at WAICapture.vb

    What should i do ?

  3. Hi, thanks for your words, what did you mean by tutorial, I added a small documentation check if it can help. if you need more help just let me know

  4. hello thanks for your reply. I am using alfresco Community 3.2 and I have this error when i click on Devices->select a device :

    System.Runtime.InteropServices.COMException (0x80070422): Creating an instance of the COM component with CLSID {850D1D11-70F3-4BE5-9A11-77AA6B2BB201} from the IClassFactory failed due to the following error: 80070422.
    at scanningWAI.WAICapture.GetDevice() in C:\Documents and Settings\khaderr\Desktop\capturesco\scanningWAI\WAICapture.vb:line 57
    at scanningWAI.WAICapture.SelectADeviceToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Documents and Settings\khaderr\Desktop\capturesco\scanningWAI\WAICapture.vb:line 52
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
    at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
    at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.ToolStrip.WndProc(Message& m)
    at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    —————————————-
    scanningWAI
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/capturesco/scanningWAI/bin/Release/scanningWAI.exe
    —————————————-
    Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
    —————————————-
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    —————————————-
    System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    —————————————-
    System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    —————————————-
    System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    —————————————-
    System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
    —————————————-
    Alfresco
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/capturesco/scanningWAI/bin/Release/Alfresco.DLL
    —————————————-
    System.Web.Services
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll
    —————————————-
    kaqbw3ut
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    Microsoft.Web.Services3
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.5305.0
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.Web.Services3/3.0.0.0__31bf3856ad364e35/Microsoft.Web.Services3.dll
    —————————————-
    System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
    —————————————-
    _qx96wze
    Assembly Version: 1.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    Interop.WIA
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/capturesco/scanningWAI/bin/Release/Interop.WIA.DLL

  5. ok one more question did you opened the solution with Visual Studio or you just ran the exe file. if you open it with visual studio you have to recompile it. An what scanner you are using, the scanner must be supported by WIA to check that go to my computer and check if the scanner is on list below after the Drivers

  6. Hello
    i have download your code and try to open the application it have been login sucessfully
    but when i select device the it shows following exception

    Unhandled exception has occured in your application.
    if you click continue the application willignore this error and attempt to continue.if you click quit the application will close immediately

    Exception from HRESULT: 0x80210015

    how to resolve this issue
    Thanks
    Sandeep

  7. Hi,
    I was testing your application, but I’m don’t know about VB.Net. I’m getting following error:

    System.InvalidOperationException: Response is not well-formed XML. —> System.Xml.XmlException: Root element is missing.
    at System.Xml.XmlTextReaderImpl.Throw(Exception e)
    at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)
    at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XmlTextReader.Read()
    at System.Xml.XmlReader.MoveToContent()
    at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
    — End of inner exception stack trace —
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
    at Alfresco.AuthenticationWebService.AuthenticationService.endSession(String ticket) in C:\Documents and Settings\khaderr\Desktop\Copy of alfresco-ScanningDemo\Alfresco\Alfresco\Web References\AuthenticationWebService\Reference.cs:line 115
    at Alfresco.AuthenticationUtils.endSession() in C:\Documents and Settings\khaderr\Desktop\Copy of alfresco-ScanningDemo\Alfresco\Alfresco\AuthenticationUtils.cs:line 92
    at scanningWAI.login.btnlogin_Click(Object sender, EventArgs e) in C:\Documents and Settings\khaderr\Desktop\capturesco\scanningWAI\login.vb:line 9
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)

    Could you address me to solve it? Any help would be appreciated!
    Thanks in advance,
    Nowhere

  8. please i have the same problem
    i made web site to get pages from scanner and when i made it it is work well but when i put it on IIS it is not worked so i need to know what problem?

    please any one can help me

    this code i used it to scan

    CommonDialogClass class1 = new CommonDialogClass();
    Device d = class1.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true, false);
    if (d != null)
    {
    }
    else
    {
    return 0;
    }
    WIA.CommonDialog WiaCommonDialog = new CommonDialogClass();
    bool hasMorePages = true;

    int numPages = 0;
    while (hasMorePages)
    {
    DeviceManager manager = new DeviceManagerClass();
    Device WiaDev = null;
    foreach (DeviceInfo info in manager.DeviceInfos)
    {
    WIA.Properties infoprop = null;
    infoprop = info.Properties;
    WiaDev = info.Connect();
    break;
    }
    WIA.ImageFile img = null;
    WIA.Item Item = WiaDev.Items[1] as WIA.Item;
    try
    {
    img = (ImageFile)WiaCommonDialog.ShowTransfer(Item, WIA.FormatID.wiaFormatJPEG, false);
    //System.Web.HttpServerUtility obj = new HttpServerUtility();
    //string path=obj.MapPath();
    string varImageFileName =Server.MapPath(“~\\Uploads\\Archiving\\”)+filename + x.ToString() + “.jpg”;
    if (File.Exists(varImageFileName))
    {
    File.Delete(varImageFileName);
    }
    img.SaveFile(varImageFileName);
    numPages++;
    img = null;
    }
    catch (Exception ex)
    {
    }
    finally
    {
    Item = null;
    Property documentHandlingSelect = null;
    Property documentHandlingStatus = null;
    foreach (Property prop in WiaDev.Properties)
    {
    if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_SELECT)
    documentHandlingSelect = prop;
    if (prop.PropertyID == WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS)
    documentHandlingStatus = prop;
    }

    hasMorePages = false; //assume there are no more pages
    if (documentHandlingSelect != null)
    {
    if ((Convert.ToUInt32(documentHandlingSelect.get_Value()) & WIA_DPS_DOCUMENT_HANDLING_SELECT.FEEDER) != 0)
    {
    hasMorePages = ((Convert.ToUInt32(documentHandlingStatus.get_Value()) & WIA_DPS_DOCUMENT_HANDLING_STATUS.FEED_READY) != 0);
    }
    }
    x++;
    }
    }

    and this errors thet get to me

    Creating an instance of the COM component with CLSID {850D1D11-70F3-4BE5-9A11-77AA6B2BB201} from the IClassFactory failed due to the following error: 80070005.

    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET access to a file, right-click the file in Explorer, choose “Properties” and select the Security tab. Click “Add” to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

    Stack Trace:

    [UnauthorizedAccessException: Creating an instance of the COM component with CLSID {850D1D11-70F3-4BE5-9A11-77AA6B2BB201} from the IClassFactory failed due to the following error: 80070005.]
    Scanner.ADFScan(String filename) in d:\Newpc1\NEWPC\Academy_Prince_Nayef\App_Code\DBObject\Scanner.cs:27
    SCHOOLADMIN_InboxAndOutbox_Setting_Archive.BtScan_Click(Object sender, EventArgs e) in d:\Newpc1\NEWPC\Academy_Prince_Nayef\BackEnd\Archiving\Manage\Archive.aspx.cs:654
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

  9. Hi Hany,
    Thanx for passing by… did you tried the suggested solution It is just a security and permission issue.
    ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET access to a file, right-click the file in Explorer, choose “Properties” and select the Security tab. Click “Add” to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

  10. hello M.RAMI

    thank you for your work and the time that you give us. i want to ask you a question about why don’t you give us a real executable for capturesco packaging all what this tool need without having to reconfigure the source code to make it work.

    thnks

  11. Hi, thanks for your warm words. I agree with you, you have a reason but when I start thinking to do Capturesco is a start point for other to build on it. But lately I start thinking why not to make it easy for end users too. This will be hopefully in the next coming version 2.5 after finish the current RC version 2.0

Leave a Reply

Your email address will not be published. Required fields are marked *