VintaSoft Twain ActiveX v6.0
In This Topic
    Upgrading guide from version 5.2 to 6.0
    In This Topic

    Programmers who currently use VintaSoft Twain ActiveX 5.2 may be a little confused of upgrading to the version 6.0 due to the fact that this require several changes in their code.

    VintaSoft developers always try to accommodate the wishes of clients and implement them in new versions and new products. Our products always evolve to meet the needs of the most exacting customers. Please take with understanding all changes we made only with one reason - make the product faster, more reliable and advanced.

    This upgrading guide will provide you the list of properties, methods and events which were added, renamed or deleted in version 6.0 to improve the ActiveX.


    VERY IMPORTANT: In version 6.0.2.1 ActiveX GUID was changed from 1169E0CD-9E76-11D7-B1D8-FB63945DE96D to 79B1D0FD-ABB9-40E8-AA06-3E499F135B49 because version 6.0 is not backward compatible with version 5.2 and many customers need to use version 5.2 and 6.0 together on the same computer. For applying this change to your application you need remove reference to old version of ActiveX from your application and add new reference to the new version of ActiveX to your application.

     


    New properties
    Property name Property description
    Device_Cameras_GetCount Gets count of device cameras.
    Device_Cap_FrameItems Gets a string array that represents Frame values of device capability.
    Device_Cap_FrameValue Gets or sets Frame value of device capability.
    Device_Cap_Name Gets or sets device capability name.
    Device_Caps_Get Gets a numeric array that represents identifiers of capabilities supported by device.
    Device_Caps_GetCount Gets count of capabilities supported by device.
    Device_IsAsyncEventsSupported Gets a value indicating whether the device supports asynchronous events.
    DeviceManager_DefaultDeviceIndex Gets index of default TWAIN device.
    DeviceManager_State Gets the state of the TWAIN device manager.
    JpegEncoder_JpegColorSpace Gets or sets image color space that JPEG encoder must use when acquired image is encoded.
    PdfEncoder_Compression Gets or sets image compression that PDF encoder must use when acquired image is encoded.
    PdfEncoder_DocumentAuthor Gets or sets the name of the person who created PDF document.
    PdfEncoder_DocumentCreationDate Gets or sets the date and time when PDF document was created.
    PdfEncoder_DocumentCreator Gets or sets the application that created or modified PDF document.
    PdfEncoder_DocumentKeywords Gets or sets the keywords associated with PDF document.
    PdfEncoder_DocumentModificationDate Gets or sets the date and time when PDF document was modified.
    PdfEncoder_DocumentProducer Gets or sets the application that converted the document to PDF format.
    PdfEncoder_DocumentSubject Gets or sets the subject of PDF document.
    PdfEncoder_DocumentTitle Gets or sets the title of PDF document.
    PdfEncoder_MultiPage Gets or sets a value indicating whether PDF encoder must create multipage PDF document.
    PdfEncoder_PdfACompatible Gets or sets a value indicating whether PDF encoder must create PDF/A document.
    PngEncoder_CompressionLevel Gets or sets image compression level that PNG encoder must use when acquired image is encoded.


    Renamed properties
    Old property name New property name
    ApplicationProductName DeviceManager_ApplicationProductName
    AutoBright Device_ImageAutoBright
    AutoFeed Device_Feeder_AutoFeed
    Brightness Device_ImageBrightness
    BrightnessMaxValue Device_ImageBrightnessMaxValue
    BrightnessMinValue Device_ImageBrightnessMinValue
    Capability Device_Cap_Id
    CapDefValue Device_Cap_DefaultValue
    CapItems Device_Cap_Items
    CapMaxValue Device_Cap_MaxValue
    CapMinValue Device_Cap_MinValue
    CapNumItems Device_Cap_Items_Count
    CapStepSize Device_Cap_StepSize
    CapStringItems Device_Cap_StringItems
    CapStringValue Device_Cap_StringValue
    CapType Device_Cap_ValueContainerType
    CapValue Device_Cap_Value
    CapValueType Device_Cap_ValueType
    Contrast Device_ImageContrast
    ContrastMaxValue Device_ImageContrastMaxValue
    ContrastMinValue Device_ImageContrastMinValue
    DataSourceState Device_State
    DeviceOnline Device_Online
    DisableAfterAcquire Device_DisableAfterAcquire
    Duplex Device_Feeder_DuplexMode
    DuplexEnabled Device_Feeder_DuplexEnabled
    EndOfJob Device_EndOfJob
    ErrorCode Error
    FeederEnabled Device_Feeder_Enabled
    FeederLoaded Device_Feeder_Loaded
    FeederPresent Device_Feeder_Present
    FileFormat Device_ImageFileFormat
    FileName Device_ImageFileName
    FlatbedPresent Device_FlatbedPresent
    FtpBytesTotal FtpUpload_BytesTotal
    FtpBytesUploaded FtpUpload_BytesUploaded
    FtpErrorCode FtpUpload_ErrorCode
    FtpErrorString FtpUpload_ErrorString
    FtpState FtpUpload_State
    FtpStateString FtpUpload_StateString
    HttpBytesTotal HttpUpload_BytesTotal
    HttpBytesUploaded HttpUpload_BytesUploaded
    HttpErrorCode HttpUpload_ErrorCode
    HttpErrorString HttpUpload_ErrorString
    HttpResponseCode HttpUpload_ResponseCode
    HttpResponseString HttpUpload_ResponseString
    HttpState HttpUpload_State
    HttpStateString HttpUpload_StateString
    IsRidicCompatible TiffEncoder_IsImageRidicCompatible
    IsTwainAvailable DeviceManager_IsAvailable
    IsTwain2Compatible DeviceManager_IsTwain2Compatible
    JobControl Device_JobControl
    JpegQuality JpegEncoder_JpegQuality
    ModalUI Device_ModalUI
    NumImages AcquiredImages_Count
    PageSize Device_PageSize
    PaperDetectable Device_Feeder_PaperDetectable
    PixelFlavor Device_ImagePixelFlavor
    PixelType Device_ImagePixelType
    Resolution Device_ImageResolution
    ShowIndicators Device_ShowIndicators
    ShowUI Device_ShowUI
    SourceIndex DeviceManager_SelectedDeviceIndex
    SourcesCount DeviceManager_DeviceCount
    TiffCompression TiffEncoder_Compression
    TiffMultiPage TiffEncoder_MultiPage
    TransferMode Device_TransferMode
    TwainDllPath DeviceManager_DllPath
    UnitOfMeasure Device_UnitOfMeasure
    XferCount Device_XferCount


    Removed properties
    Property name Description
    AutoCleanBuffer Use the AcquiredImages_Clear event if you want to clear internal images buffer.
    CancelTransfer Use the Device_CancelImageTransfer method instead.
    FtpCancel Use the FtpUpload_Cancel method instead.
    HttpCancel Use the HttpUpload_Cancel method instead.
    MaxImages Now size of internal images buffer is not limited.


    New methods
    Method name Method description
    AcquiredImages_ChangeBrightness Changes the brightness of the image.
    AcquiredImages_ChangeContrast Changes the contrast of the image.
    AcquiredImages_Clear Clears acquired image collection and deletes all acquired images.
    AcquiredImages_Crop Crops specified region of an image.
    AcquiredImages_GetImageTileAsBase64String Returns tile of acquired image as Base64 string.
    AcquiredImages_GetImageThumbnailAsBase64String Returns thumbnail of acquired image as Base64 string.
    AcquiredImages_InvertImage Inverts the image.
    AcquiredImages_ResizeCanvas Changes size of image canvas.
    Device_CancelImageTransfer Sends the cancel current transfer command to the device (transfer will not be canceled right after execution of this method).
    Device_ClearBuffers Clears the device buffers according to the specified mode.
    Device_Disable Disables the device.
    Device_Enable Enables the device.
    Device_Camera_GetName Gets name of device camera.
    Device_Camera_GetType Gets type of device camera.
    Device_Info_GetDriverVersion Returns version of the device driver.
    Device_GetSettings Returns the current device settings as string.
    Device_GetSupportedAsyncEvents Returns an array of asynchronous events supported by device.
    Device_Info_IsWia Determines that device driver is WIA driver.
    Device_SetSettings Loads device settings from string.
    Device_Feeder_Stop Stops the automatic document feeder if possible.
    DeviceManager_Close Closes the TWAIN device manager.
    DeviceManager_FindDevice Finds the device by device's name.
    DeviceManager_Open Opens the TWAIN device manager.
    FtpUpload_Cancel Cancels current image uploading process to FTP server.
    HttpUpload_Cancel Cancels current image uploading process to HTTP server.
    HttpUpload_ClearAllFileFields Clears all file fields of HTTP form.
    HttpUpload_ClearAllTextFields Clears all text fields of HTTP form.


    Renamed methods
    Old method name New method name
    Acquire Device_AcquireImage
    AcquireModal Device_AcquireImageModal
    CloseDataSource Device_Close
    DeleteImage AcquiredImages_Delete
    DeskewImage AcquiredImages_Deskew
    DespeckleImage AcquiredImages_Despeckle
    DetectImageBorder AcquiredImages_DetectBorder
    GetCap Device_Cap_Get
    GetCapUsageMode Device_Cap_GetUsageMode
    GetImage AcquiredImages_GetImage
    GetImageAsBase64String AcquiredImages_GetImageAsBase64String
    GetImageAsByteArray AcquiredImages_GetImageAsByteArray
    GetImageAsDIB AcquiredImages_GetImageAsDIB
    GetImageAsHBitmap AcquiredImages_GetImageAsHBitmap
    GetImageAsHDIB AcquiredImages_GetImageAsHDIB
    GetImageBPP AcquiredImages_GetImageBitDepth
    GetImageHeight AcquiredImages_GetImageHeight
    GetImageLayout Device_GetImageLayout
    GetImageLayoutAsString Device_GetImageLayoutAsString
    GetImageWidth AcquiredImages_GetImageWidth
    GetImageXRes AcquiredImages_GetImageXRes
    GetImageYRes AcquiredImages_GetImageYRes
    GetPageSizes Device_GetSupportedPageSizes
    GetPixelTypes Device_GetSupportedPixelTypes
    GetResolutions Device_GetSupportedResolutions
    GetSourceManufacturer Device_Info_GetManufacturer
    GetSourceProductFamily Device_Info_GetProductFamily
    GetSourceProductName Device_Info_GetProductName
    GetSourceTwainVersion Device_Info_GetTwainVersion
    GetUnitsOfMeasure Device_GetSupportedUnitsOfMeasure
    IsBlankImage AcquiredImages_IsBlank
    IsCapSupported Device_Cap_IsSupported
    IsSourceTwain2Compatible Device_IsTwain2Compatible
    OpenDataSource Device_Open
    RotateImage AcquiredImages_Rotate
    SaveImage AcquiredImages_Save
    SaveImageToFtp FtpUpload_UploadImage
    SaveImageToHttp HttpUpload_UploadImage
    SelectSource DeviceManager_ShowDefaultDeviceSelectionDialog
    SetCap Device_Cap_Set
    SetFtpProxyServerParams FtpUpload_SetProxyServerParams
    SetFtpServerAdvParams FtpUpload_SetServerAdvancedParams
    SetFtpServerParams FtpUpload_SetServerParams
    SetHttpCookie HttpUpload_SetCookie
    SetHttpFormField HttpUpload_SetFormField
    SetHttpProxyServerParams HttpUpload_SetProxyServerParams
    SetHttpServerParams HttpUpload_SetServerParams
    SetImageLayout Device_SetImageLayout
    SetupSource Device_ShowSetupDialog
    SwapImages AcquiredImgaes_Swap


    Removed methods
    Method name Description
    StartDevice Use the DeviceManager_Open method instead.
    StopDevice Use the Device_Close and DeviceManager_Close methods instead.
    SetHttpFileFromDisk ActiveX version 5.2 in one session can upload only one image file to HTTP server. For solving this problem several images can be saved into multipage TIFF or PDF file and saved file can be uploaded to HTTP server using the SetHttpFileFromDisk method.
    Since version 6.0 the SetHttpFileFromDisk method is not necessary because several images can be added to HTTP request using the HttpUpload_AddFileField method.


    New events
    Event name Event description
    AcquiredImages_ImageProcessingProgress Occurs when progress of image processing is changed.
    Device_AsyncEvent Occurs when the asynchronous device event is occurs.
    Device_ImageAcquired Occurs when image is acquired from device.
    Device_ImageAcquiring Occurs when image acquisition starts.
    Device_ImageAcquiringProgress Occurs when image acquisition is in progress (only if Memory transfer mode is used).
    Device_ScanCanceled Occurs when scan process is canceled.
    Device_ScanCompleted Occurs when scan process is successfully completed.
    Device_ScanFailed Occurs when scan process is failed.
    Device_ScanFinished Occurs when asynchronous image acquisition is finished (completed, canceled or failed)./td>
    Device_UserInterfaceClosed Occurs when the User Interface of device is closed.
    DeviceManager_OpenedDeviceChanged Occurs when the opened device is changed.
    DeviceManager_OpenedDeviceChanging Occurs before the opened device is changing.
    FtpUpload_Completed Occurs when image uploading process to FTP server is completed.
    FtpUpload_ProgressChanges Occurs when progress of image uploading process to FTP server is changed.
    FtpUpload_StatusChanged Occurs when status of image uploading process to FTP server is changed.
    HttpUpload_Completed Occurs when image uploading process to HTTP server is completed.
    HttpUpload_ProgressChanged Occurs when progress of image uploading process to HTTP server is changed.
    HttpUpload_StatusChanged Occurs when status of image uploading process to HTTP server is changed.


    Removed events
    Event name Description
    PostScan Use the Device_ImageAcquiring, Device_ImageAcquired, Device_ScanCompleted, Device_ScanFinished, Device_ScanCanceled, Device_ScanFailed and Device_UserInterfaceClosed events instead.
    Progress Use the Device_ImageAcquiringProgress, AcquiredImages_ImageProcessingProgress, HttpUpload_ProgressChanged or FtpUpload_ProgressChanges event instead.



    Code snippets for version 5.2 and 6.0

    1. Here is a code snippet that shows how to asynchronously acquire image from scanner and save acquired image to TIFF file.

      ' Asynchronously scan images in Vintasoft Twain ActiveX 5.2
      Private Sub AsyncScan_v5_2()
          ' open device manager
          VSTwain1.StartDevice()
          ' select device using standard device selection dialog
          If VSTwain1.SelectSource() = 1 Then
              ' specify that device UI must be shown
              VSTwain1.ShowUI = True
      
              ' acquire images asynchronously
              VSTwain1.Acquire()
          End If
      End Sub
      
      Private Sub VSTwain1_PostScan(ByVal flag As Long)
          If Flag <> 0 Then
              If VSTwain1.ErrorCode <> 0 Then
                  MsgBox VSTwain1.ErrorString
              End If
          Else
              Set Image1.Picture = VSTwain1.GetCurrentImage()
              If Not VSTwain1.SaveImage(0, "c:\test.tiff") Then
                  MsgBox(VSTwain1.ErrorString)
              End If
          End If
      End Sub

      ' Asynchronously scan images in Vintasoft Twain ActiveX 6.0
      Public Sub AsyncScan_v6_0()
          ' specify application name
          VSTwain1.DeviceManager_ApplicationProductName = "MyTwainApplication"
          ' open device manager
          If VSTwain1.DeviceManager_Open() Then
              ' select device using standard device selection dialog
              VSTwain1.DeviceManager_ShowDefaultDeviceSelectionDialog()
      
              ' specify that device UI must be shown
              VSTwain1.Device_ShowUI = True
      
              ' acquire images asynchronously
              VSTwain1.Device_AcquireImage()
          End If
      End Sub
      
      Private Sub VSTwain1_ImageAcquired()
          ' get index of acquired image
          Dim imageIndex As Integer = VSTwain1.AcquiredImages_Count - 1
      
          ' save acquired image to TIFF file
          If Not VSTwain1.AcquiredImages_Save(imageIndex, "test.tif") Then
              MsgBox(VSTwain1.errorString)
          End If
      End Sub
      
      Private Sub VSTwain1_ScanCompleted()
          MsgBox("Scan is completed.")
      End Sub
      
      Private Sub VSTwain1_ScanFailed(errorString As String)
          MsgBox(String.Format("Scan is failed: {0}.", errorString))
      End Sub
      
      Private Sub VSTwain1_ScanCanceled()
          MsgBox("Scan is canceled.")
      End Sub



    2. Here is a code snippet that shows how to synchronously acquire image from scanner and save acquired image to TIFF file.

      ' Synchronously scan images in Vintasoft Twain ActiveX 5.2
      Public Sub SyncScan_v5_2()
          ' specify application name
          VSTwain1.AppProductName = "MyTwainApplication"
          ' open device manager
          If VSTwain1.StartDevice() Then
              ' select device using standard device selection dialog
              VSTwain1.SelectSource()
      
              ' specify that device UI must be shown
              VSTwain1.ShowUI = True
      
              ' run synchronous image acquisition
              While VSTwain1.AcquireModal()
                   ' save acquired image to TIFF file
                  If Not VSTwain1.SaveImage(0, "c:\test.tiff") Then
                      MsgBox(VSTwain1.ErrorString)
                  End If
              End While
          Else
              MsgBox VSTwain1.ErrorString
          End If
      End Sub

      ' Synchronously scan images in Vintasoft Twain ActiveX 6.0
      Public Sub SyncScan_v6_0()
          ' specify application name
          VSTwain1.DeviceManager_ApplicationProductName = "MyTwainApplication"
          ' open device manager
          If VSTwain1.DeviceManager_Open() Then
              ' select device using standard device selection dialog
              VSTwain1.DeviceManager_ShowDefaultDeviceSelectionDialog()
      
              ' specify that device UI must be shown
              VSTwain1.Device_ShowUI = True
      
              ' run synchronous image acquisition
              Dim acquireModalState1 As VSTwainLib.ACQUIREMODALSTATE = ACQUIREMODALSTATE.ACQUIREMODALSTATE_None
              Do
                  acquireModalState1 = VSTwain1.Device_AcquireImageModal()
                  Select Case acquireModalState1
                      Case ACQUIREMODALSTATE.ACQUIREMODALSTATE_ImageAcquired
                          ' save acquired image to TIFF file
                          If Not VSTwain1.AcquiredImages_Save(0, "c:\test.tif") Then
                              MsgBox(VSTwain1.ErrorString)
                          End If
      
                          ' delete image from internal image buffer
                          VSTwain1.AcquiredImages_Clear()
                      Exit Select
      
                      Case ACQUIREMODALSTATE.ACQUIREMODALSTATE_ScanCompleted
                          MsgBox("Scan is completed.")
                          Exit Select
      
                      Case ACQUIREMODALSTATE.ACQUIREMODALSTATE_ScanCanceled
                          MsgBox("Scan is canceled.")
                          Exit Select
      
                     Case ACQUIREMODALSTATE.ACQUIREMODALSTATE_ScanFailed
                         MsgBox(String.Format("Scan is failed: {0}.", VSTwain1.ErrorString))
                         Exit Select
                  End Select
              Loop While acquireModalState1 <> ACQUIREMODALSTATE.ACQUIREMODALSTATE_None
          End If
      End Sub