TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Reply To: How to dynamically determine scanned paper size

Forums › TWAIN Classic › How to dynamically determine scanned paper size › Reply To: How to dynamically determine scanned paper size

January 11, 2008 at 10:05 pm #24262
gabe
Participant
  • Topics - 9
  • Replies - 583
  • Total Posts - 592

timing. you call it in twState 6 or 7 (pg 238 of the 1.9pspec or my previous post) I call the previous code from the sub that gets the images, and actually when you read most of the sample code available the code you posted is usually unside an if stmt that doesn’t execute unless the code I posted returned True.


Dim PendingXfers As Boolean = True

Do While PendingXfers = True

If GetImageInfo() Then

'Transfer the image natively
hbitmap = IntPtr.Zero

Select Case OperationTriplets.Image.ImageNativeXfer.Get(hbitmap)

Case Enumerations.ReturnCode.XferDone

fileName = NextAvailableFilename(sessionDir.FullName, _
_CurrentImageFileFormat.ToString.ToLower) 'sfd.FileName
Trace.WriteLine(" " & fileName)
Plumbing.DibToBmp.DibHandToBmp(hbitmap).Save(fileName)
_Images.Add(fileName)
PendingXfers = DoEndXfer()

Case Enumerations.ReturnCode.Cancel
PendingXfers = DoEndXfer()

Case Enumerations.ReturnCode.Failure

Dim mStatusShort As Enumerations.ConditionCode
mStatusShort = OperationTriplets.Control.Status.Get()
If mStatusShort <> Enumerations.ConditionCode.Success Then
myTrace.WriteLine(" " & System.Enum.GetName(GetType(Enumerations.ConditionCode), mStatusShort), Instrumentation.TraceLevelEnum.Information)
myTrace.WriteLine(" " & DataStructures.twStatus.ConditionDescription(mStatusShort), Instrumentation.TraceLevelEnum.Information)
End If

DoAbortXfer()
PendingXfers = False

End Select

End If

Loop
Trace.WriteLine("Native loop finished")

the rest of this code is over at http://www.codeplex.com/openTwain on the releases tab in a zip, in a file named cTwain.vb around line 1100ish

.

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in