Results 1 to 4 of 4
  1. #1
    wackywoo105 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2014
    Posts
    34

    Saving duplex 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?

    Code:
    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
    kd2017 is offline Well, I tried at least.
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    1,142
    I have no idea, hopefully someone here will sort you out.

    In case they don't I wanted to comment that in my projects I've actually been calling NAPS2 scanning software by executing command line calls from access VBA... Just a last resort idea if you want to explore it later.

  3. #3
    wackywoo105 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2014
    Posts
    34
    Quote Originally Posted by kd2017 View Post
    I have no idea, hopefully someone here will sort you out.

    In case they don't I wanted to comment that in my projects I've actually been calling NAPS2 scanning software by executing command line calls from access VBA... Just a last resort idea if you want to explore it later.
    Thanks. I already tried NAPS2. I was initially happy but then realised it was not saving some scans. If for instance I run it via command line on 20 pages duplex, I find it only saves say 36 pages. When you open the GUI interface the missing pages show up and it offers to recover and save them. I also like to scan landscape as it's quicker. With wia I can then rotate the image before saving but NAPS2 doesn't have that option.

    It's a shame as the program is so close but just not quite there.

    I also found a program called CLScan (command line scanner). Sadly this won't perform duplex scanning for some reason.

    EDIT: 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.

  4. #4
    wackywoo105 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2014
    Posts
    34
    Can anyone help with this?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Duplex Printing for a Report
    By NewbyForAccess in forum Reports
    Replies: 0
    Last Post: 11-02-2018, 01:52 PM
  2. Scan Into Folder
    By angie in forum Programming
    Replies: 1
    Last Post: 01-12-2016, 01:45 PM
  3. Replies: 3
    Last Post: 05-30-2015, 02:57 PM
  4. Duplex Printing
    By Siuxia in forum Programming
    Replies: 2
    Last Post: 09-05-2012, 01:47 AM
  5. Duplex Printing
    By Dale S in forum Reports
    Replies: 2
    Last Post: 05-31-2012, 09:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums