Consulting

Results 1 to 3 of 3

Thread: Saving duplex scan using wia scan

  1. #1

    Saving duplex scan using wia scan

    I use the following code to scan. I have manged to get it scanning from ADF correctly single sided. I also want to duplex scan. When I change document handling properties to duplex the scanner runs and clearly performs duplex scanning. The problem is nothing is saved.

    What do I need to modify to make it save a duplex scan?

    I've read a bit about calling the image transfer twice with duplex scanning. All the examples I've found are for C# coding though so I don't know the VBA equivalent.

    I've even tried a couple of command line scanners NAPS2 and CLScan but sadly they don't work fully.

    Function ScanDocNow(info As String, Counter As Integer, sizeh As Integer, sizev As Integer, ADF As Boolean, Duplex As Boolean, Rotate As Boolean)
    Dim wiaImg As New WIA.ImageFile
    Dim wiaDialog As New WIA.CommonDialog
    Dim wiaScanner As WIA.Device
     
    If ADF = True Then
        If Duplex = True Then
            wiaScanner.Properties.item("3088").Value = 5 ‘ duplex
        Else
            wiaScanner.Properties.item("3088").Value = 1 ‘ one sided
        End If
    End If
     
    With wiaScanner.Items(1)
        .Properties("6146").Value = 1 '4 is Black-white,gray is 2, color 1 (Color Intent)
        .Properties("6147").Value = 200 'dots per inch/horizontal was set at 100
        .Properties("6148").Value = 200 'dots per inch/vertical was set ao 100
        .Properties("6149").Value = 0 'x point where to start scan
        .Properties("6150").Value = 0 'y-point where to start scan
        .Properties("6152").Value = sizev 'vertical extent DPI x inches tall was 2334
        .Properties("6151").Value = sizeh 'horizontal exent DPI x inches wide was 1660
         Set wiaImg = .Transfer(wiaFormatJPEG) 'Change file type in save to match format
    End With
     
    Dim IP As ImageProcess
     
    Set IP = CreateObject("WIA.ImageProcess")
    IP.Filters.Add IP.FilterInfos("RotateFlip").FilterID
    IP.Filters(1).Properties("RotationAngle") = 270
    Set wiaImg = IP.Apply(wiaImg)
    Set IP = Nothing
     
    Set IP = CreateObject("WIA.ImageProcess")
    IP.Filters.Add (IP.FilterInfos("Convert").FilterID)
    IP.Filters(1).Properties("FormatID").Value = WIA.FormatID.wiaFormatJPEG
    IP.Filters(1).Properties("Quality").Value = 25
    Set wiaImg = IP.Apply(wiaImg)
     
    If Counter = 1 Then
        wiaImg.SaveFile (gdrive & "Scan and Bin\" & Format(Date, "yyyy_mm_dd") & "_" & Format(Time, "hh_mm_ss") & "_" & info & ".jpg")
    Else
        wiaImg.SaveFile (gdrive & "Scan and Bin\" & Format(Date, "yyyy_mm_dd") & "_" & Format(Time, "hh_mm_ss") & "_" & info & "_" & Counter & ".jpg")
    End If
     
    Set wiaImg = Nothing
    Set wiaScanner = Nothing
     
    End Function

  2. #2
    Can anyone help with this?

  3. #3
    ok so we have a group of people still waiting for any suggestions passionately :')
    ~ Check this Getcellphonespy platform that I'm currently working on ~

Posting Permissions

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