Create 2 multipage tiffs from scanned images

Example requests & Code samples for GdPicture Toolkits.
Post Reply
mfunai
Posts: 9
Joined: Mon Aug 04, 2008 11:04 pm

Create 2 multipage tiffs from scanned images

Post by mfunai » Thu Sep 11, 2008 11:08 pm

I need a way to make 2 sets of files from my scanned images. I need 1 set with blank pages and one set without. I can't figure out how to do this, is there a way to make 2 multipage tiff files with these images?

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

Re: Create 2 multipage tiffs from scanned images

Post by Loïc » Sat Sep 13, 2008 10:53 am

HI,

There is a lot a ways to do that using the Imaging class.

I give you one of them consisting to use 2 Imaging Objects. One for the main multipage tiff file, and one other for the multipage which contains the detected blank pages.

Code: Select all

Dim Imaging1 As New GdPicturePro5.cImaging
Dim Imaging2 As New GdPicturePro5.cImaging
Dim nImageCount As Long
Dim nBlankImageCount As Long
Dim nImageID As Long

Call Imaging1.TwainOpenDefaultSource
nImageCount = 0
Imaging1.TwainSetAutoFeed (True)
Imaging1.TwainSetAutoScan (True)
While Imaging1.CreateImageFromTwain(Me.hWnd) <> 0
      nImageID = Imaging1.GetNativeImage
      If Imaging1.IsBlank(99) Then
          nImageCount = nImageCount + 1
          If nImageCount = 1 Then
             Call Imaging1.TiffSaveAsNativeMultiPage(App.Path & "\multipage.tif", CompressionCCITT4)
          Else
             Imaging1.TiffAddToNativeMultiPage (nImageID)
             Imaging1.CloseImage (nImageID)
          End If
      Else
          nBlankImageCount = nBlankImageCount + 1
          If nBlankImageCount = 1 Then
             Imaging2.SetNativeImage (nImageID)
             Call Imaging2.TiffSaveAsNativeMultiPage(App.Path & "\multipageblank.tif", CompressionCCITT4)
          Else
             Imaging2.TiffAddToNativeMultiPage (nImageID)
             Imaging1.CloseImage (nImageID)
          End If
      End If
Wend
Imaging1.TiffCloseNativeMultiPage
Imaging2.TiffCloseNativeMultiPage
Imaging1.TwainCloseSource

MsgBox "Done !"

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests