TWAIN Imprinting with dotnet

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
melsonj1
Posts: 1
Joined: Fri Sep 09, 2011 2:52 pm

TWAIN Imprinting with dotnet

Post by melsonj1 » Fri Sep 09, 2011 3:01 pm

Hi

I can not find an example on how to set the imprinting value we need to spray on each page of the document when it is scanned we use the following formula in our current application that I have been tasked to replace

YYJJJX99999 YYJJJ p999

where the first julian date is the scandate the X is fixed the 99999 is the document sequence for that day the Second Julian Date is the Date of Reciept and the last information is the page number. we use seperator sheets to increment the document number, I have that part figured out. the code I am using is as follows

Code: Select all

 'Here we will scan in a 1bpp ccitt4 & 200 DPI from adf to multipage tif file
        If IsNothing(Me.Unit) Then
            MsgBox("Must Set Unit ID First", MsgBoxStyle.MsgBoxHelp)
            Exit Sub
        End If
        If IsNothing(Me.DOR) Then
            MsgBox("Must Set DOR First", MsgBoxStyle.MsgBoxHelp)
            Exit Sub
        End If

        Dim nImageCount As Integer
        Dim ImageID As Integer
        Dim MultiPageID As Integer
        Dim nTemplateSeperator As Long
        Dim nCloserTemplate As Long

        If OpenSelectedSource() Then
            nImageCount = 0

            oGdPictureImaging.TwainSetHideUI(CBool(chkHideUI.CheckState))
            oGdPictureImaging.TwainSetIndicators(CBool(chkIndicator.CheckState))

            oGdPictureImaging.TwainSetAutoFeed(True) 'Set AutoFeed Enabled
            oGdPictureImaging.TwainSetAutoScan(True) 'To  achieve the maximum scanning rate

            oGdPictureImaging.TwainSetResolution(200)
            oGdPictureImaging.TwainSetPixelType(TwainPixelType.TWPT_BW) 'Black & White
            oGdPictureImaging.TwainSetBitDepth(1) ' 1 bpp

            'First Aquire the Seperator Page
            ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
            nTemplateSeperator = oGdPictureImaging.ADRCreateTemplateFromGdPictureImage(ImageID)
            Do
                'Now start scanning the Document
                ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
                If ImageID <> 0 Then
                    'If We detect a seperator Page then Output the file and reset the pagecount
                    nCloserTemplate = oGdPictureImaging.ADRGetCloserTemplateForGdPictureImage(ImageID)
                    If nCloserTemplate = nTemplateSeperator And oGdPictureImaging.ADRGetLastConfidence >= 92 Then
                        'A Paper seperator was detected save the file
                        oGdPictureImaging.TiffCloseMultiPageFile(MultiPageID)
                        nImageCount = 0
                        Me.Sequence = Me.Sequence + 1
                    Else
                        nImageCount = nImageCount + 1
                        Call ApplyImageFilters(ImageID)
                        If chkPreview.CheckState = 1 Then Call DisplayImage(ImageID)
                        If nImageCount = 1 Then
                            MultiPageID = ImageID
                            If Directory.Exists(sDroppoint) Then
                            Else
                                Directory.CreateDirectory(sDroppoint)
                            End If
                            Call oGdPictureImaging.TiffSaveAsMultiPageFile(MultiPageID, sDroppoint & Me.ScanDate & "X" & Me.Sequence & "." & Me.Unit & ".tif", TiffCompression.TiffCompressionCCITT4)
                        Else
                            oGdPictureImaging.TiffAddToMultiPageFile(MultiPageID, ImageID)
                            oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                        End If
                    End If
                    
                End If

            Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED

            oGdPictureImaging.TiffCloseMultiPageFile(MultiPageID)
            oGdPictureImaging.TwainCloseSource()
            MsgBox("Done !")
        End If
How do I set these so that they spray on each document scanned using twain scanning. in dotnet


Thanks

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: TWAIN Imprinting with dotnet

Post by Loïc » Mon Sep 12, 2011 10:36 am

Hi,

If your scanner has a imprinter device, you can control it through:

TwainIsEndorserAvailable()
TwainSetEndorserNumber()
TwainSetImprinterIndex()
TwainEnableImprinter()
TwainGetAvailableImprinterModeNo()
TwainGetAvailableImprinterModeCount()
TwainIsImprinterAvailable()
TwainIsImprinterEnabled()
TwainGetImprinterMode()
TwainSetImprinterMode()
TwainGetImprinterString()
TwainSetImprinterString()
...

Just have a look on the reference guide to list all available methods in the GdPcitureImaging methods / TWAIN features.

Another solution consists to use the drawing method of the Toolkit wich allow to daraw string specifying alignment, font & size. See the Drawing text section.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest