Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
Posts: 4
Joined: Wed Jul 08, 2009 3:59 pm


Post by RTCaylor » Tue Feb 09, 2010 9:43 pm

I am using an HP Officejet J6480 for scanning. When I use the automatic document feeder, I am always getting a legal sized document instead of the letter sized document I requested. Any ideas as to why? Here is my code...

Code: Select all

If theScanner.TwainOpenDefaultSource() Then
    done = False
    page = 0

    filePathname = GetTempPath() & "\" & "ScanTestFullDocument" & testNumber & ".pdf"
    pageBasePathname = GetTempPath() & "\" & "ScanTestDoc" & testNumber & "Page"

    UpdateStatus "Configure theScanner..."

    With theScanner
      .TwainSetHideUI True
      .TwainSetCurrentResolution 150
      .TwainSetCurrentPixelType TWPT_GRAY
      .TwainSetCurrentBitDepth (8)
      .TwainSetAutoFeed True
      .TwainSetAutoScan False
      .TwainSetAutoSize False
      .TwainSetAutomaticDeskew False
      .TwainSetPaperSize USLETTER

    End With

    UpdateStatus "TwaindPdfStartEx..."

    If theScanner.TwainPdfStartEx(filePathname) = 0 Then

      While Not done
        page = page + 1

        UpdateStatus "TwainAcquireToGdPictureImage Page " & page & " ..."
        If theScanner.TwainAcquireToGdPictureImage(hwnd) = 0 Then
          done = True

          theViewer.SetNativeImage (theScanner.GetNativeImage())

          pageThisPathname = pageBasePathname & page & ".pdf"

          theScanner.SaveAsPDFEx pageThisPathname

          UpdateStatus "TwainAddGdPictureImageToPdf Page " & page & " ..."

          theScanner.TwainAddGdPictureImageToPdf (theScanner.GetNativeImage)
        End If


      UpdateStatus "TwainPdfStop, Page Count = " & page

    End If

    UpdateStatus "TwainCloseSource, Page Count = " & page
    UpdateStatus "Done, Page Count = " & page
    UpdateStatus "TwainOpenDefaultSource failed."
  End If

Posts: 4
Joined: Wed Jul 08, 2009 3:59 pm

Re: PaperSize

Post by RTCaylor » Tue Feb 23, 2010 8:36 pm

We have one of our users that is also having a similar problem like this using the application we developed based on your control (don't have the make and model of the scanner he is using). Things are fine when he scans from the platen, but gets messed up when using the automatic document feeder. If he opens the driver UI the default paper size is A4. If he simply changes to 8.5x11 then the scans look good. I've attached the two documents so you can see what is going on.
Zip containing good and bad PDFs.
(151.4 KiB) Downloaded 161 times

User avatar
Site Admin
Posts: 5698
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: PaperSize

Post by Loïc » Wed Feb 24, 2010 9:50 am

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests