dcsimg
Results 1 to 4 of 4

Thread: WIA scan multi-page to TIFF from sheet feeder

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    63

    WIA scan multi-page to TIFF from sheet feeder

    Hi

    I'm having a problem scanning a multi-page document from ADF. Even though multiple pages go through the ADF when scanning, the scanners progress bar seems to finish at the end of page one, and the document saved is a single page only.

    example code snippets:

    Private WiaDlg As WIA.CommonDialog
    Private WiaDev As WIA.Device

    Set WiaDlg = CreateObject("WIA.CommonDialog") ' New WIA.CommonDialog
    Set WiaDev = WiaDlg.ShowSelectDevice(ScannerDeviceType, AlwaysSelectDevice:=True, CancelError:=True)

    Dim w As WIA.ImageProcess
    Dim WiaRootItem As WIA.Item
    Dim WiaIntent As WIA.WiaImageIntent
    Dim WiaImageFile As WIA.ImageFile

    WiaIntent = UnspecifiedIntent

    WiaDlg.ShowSelectItems WiaDev, WiaIntent, MinimizeSize, True, False

    Set WiaRootItem = WiaDev.Items(1) 'Root\Top item of the device.

    Set WiaImageFile = WiaDlg.ShowTransfer(WiaRootItem, FormatID:=wiaFormatTIFF, CancelError:=True)

    now the interesting thing is after WiaImageFile is set, if I interrogate WiaImageFile.FormatID, its actually BMP, which might have something to do with the problem
    If I then convert to TIF, then its only a single page file

    eg.
    If WiaImageFile.FormatID <> wiaFormatTIFF Then
    Set w = CreateObject("Wia.ImageProcess") ' New WIA.ImageProcess
    With w
    .Filters.Add .FilterInfos![Scale].FilterID
    With .Filters(1).Properties
    ![PreserveAspectRatio].Value = True
    End With
    .Filters.Add .FilterInfos![Convert].FilterID
    With .Filters(2).Properties
    ![FormatID].Value = wiaFormatTIFF
    End With
    Set WiaImageFile = .Apply(WiaImageFile)
    End With
    End If
    WiaImageFile.SaveFile m_sScanFile

    Any help on how to create multi-page TIFF documents through WIA would be very much appreciated

    Also, is there a way to scan a page at a time, and append to file? WiaImageFile.SaveAs can only generate a NEW file each time. It would be handy to do this when scanning 1 page at a time (eg. from the flatbed) to generate a muti-page tiff as the result.

    Many thanks for any pointers
    Last edited by hawker; Nov 7th, 2019 at 09:38 AM.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,633

    Re: WIA scan multi-page to TIFF from sheet feeder

    The documentation covers this and even provides a dumbed down VBScript sample:

    Frame Filter: Create a Multi-Page TIFF from Three Pictures

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    63

    Re: WIA scan multi-page to TIFF from sheet feeder

    Thanks for that, which can certainly help me for single page scans
    However, it doesn't address the issue of scanning multiple pages using the sheet feeder...when the sheet feeder is chosen and the scan is performed, all sheets are "read" but only a single page file is produced

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,633

    Re: WIA scan multi-page to TIFF from sheet feeder

    Look into the DeviceManager object.

    If your device supports events that report each scan (wiaEventItemCreated) and perhaps even a "feeder empty" event, you could register for those events and handle them in DeviceManager_OnEvent.

    Look for the "Download New Items as They are Created" sample in the documentation.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width