Home › Forums › TWAIN Classic › AUTODISCARDBLANKPAGES
- This topic has 5 replies, 3 voices, and was last updated 13 years, 8 months ago by fct.
- AuthorPosts
Hallo,
can you say me, how is the syntax for AUTODISCARDBLANKPAGES?
The code:Dim capDiscardBlank As TwCapability = New TwCapability(TwCap.ICAP_AUTODISCARDBLANKPAGES, 1)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDiscardBlank)has no effect. By using the original driver (guif.ShowUI = 1), the empty sides are removed. My scanner is a CANON DR-2580C document scanner.
Thanks for an answer .
NorbertMore Code:
Friend Enum TwCap As Short
XferCount = &H1
ICompression = &H100
IPixelType = &H101
IUnits = &H102
IXferMech = &H103
CAP_DUPLEXENABLED = &H1013
CAP_RESX = &H1118
CAP_RESY = &H1119
ICAP_SUPPORTEDSIZES = &H1122
ICAP_AUTOMATICDESKEW = &H1151
ICAP_AUTOMATICROTATE = &H1152
ICAP_AUTODISCARDBLANKPAGES = &H1134
ICAP_NOISEFILTER = &H1148
ICAP_AUTOBRIGHT = &H1100
CAP_AUTOSCAN = &H1010
ICAP_THRESHOLD = &H1123
ICAP_BRIGHTNESS = &H1101
ICAP_GAMMA = &H1108
ICAP_HALFTONES = &H1109
ICAP_PIXELFLAVOR = &H111F
End Enum
Public Function Acquire() As Boolean
Dim rc As TwRC
CloseSrc()
If Equals(appid.Id, IntPtr.Zero) = True Then
Init(hwnd)
If Equals(appid.Id, IntPtr.Zero) = True Then
Return False
End If
End If
rc = DSMident(appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds)
Dim cap As TwCapability = New TwCapability(TwCap.XferCount, -1)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap)
Dim capDuplex As TwCapability = New TwCapability(TwCap.CAP_DUPLEXENABLED, 1, TwType.Bool)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDuplex)
Dim capResX As TwCapability = New TwCapability(TwCap.CAP_RESX, 96, TwType.Fix32)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capResX)
Dim capResY As TwCapability = New TwCapability(TwCap.CAP_RESY, 96, TwType.Fix32)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capResY)
Dim capPixelType As TwCapability = New TwCapability(TwCap.IPixelType, 1)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capPixelType)
Dim capPaperSize As TwCapability = New TwCapability(TwCap.ICAP_SUPPORTEDSIZES, 1)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capPaperSize)
Dim capAutoDeskew As TwCapability = New TwCapability(TwCap.ICAP_AUTOMATICDESKEW, 1, TwType.Bool)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capAutoDeskew)
Dim capDiscardBlank As TwCapability = New TwCapability(TwCap.ICAP_AUTODISCARDBLANKPAGES, 1)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDiscardBlank)
Dim guif As TwUserInterface = New TwUserInterface()
guif.ShowUI = gui
guif.ModalUI = gui
guif.ParentHand = hwnd
Try
rc = DSuserif(appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.EnableDS, guif)
Catch ex As Exception
MessageBox.Show("Scannen nicht möglich", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
If (rc <> TwRC.Success) Then Return False
Return True
End FunctionCheck here. You should be using -1 and -2, not 1.
http://www.dynamsoft.com/help/twain/ICAP_AUTODISCARDBLANKPAGES.htm
Hope it helps.
Edit: a value =0 or greater might specify the threshold, but it depends on manufacturer’s implementation. From my experience you have to use extra custom caps for the blank page threshold. I guess automatic mode (-1) is the one that might best serve you.
Hallo,
with -1 I have the same error.Dim capDiscardBlank As TwCapability = New TwCapability(TwCap.ICAP_AUTODISCARDBLANKPAGES, -1)
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDiscardBlank)rc = 1 (Scanner.TwRC.Failure)
But the scanner can do DISCARDBLANKPAGES!
Best regards from Germany
Norberti think the scanner implements AUTODISCARDBLANKPAGES by other capability. won’t you contact the maker’s support?
Yes, I have called any location of Cannon germany support , but I got no usable information. Perhaps have you other hints/ideas for me?
Best regards
Norbert@strzata wrote:
Yes, I have called any location of Cannon germany support , but I got no usable information. Perhaps have you other hints/ideas for me?
Best regards
NorbertWell, you can try hard guessing the custom cap. No experience with Canon scanners, so I don’t know which ones they are. I wrote a guide here, though:
http://fmct.blogspot.com/2009/09/guessing-twain-custom-capabilities.html
Hope it helps. Viel Glück!
- AuthorPosts