Scanning multiple pages into the Viewer object?

Example requests & Code samples for GdPicture Toolkits.
Post Reply
mreynolds
Posts: 29
Joined: Fri Mar 28, 2008 3:16 am

Scanning multiple pages into the Viewer object?

Post by mreynolds » Fri Apr 25, 2008 4:40 am

I can DisplayFromPdfFile and end up with multiple pages in the Viewer, but if I use AxGdViwer1.DisplayFromGdPictureImage(AxImaging1.GetNativeImage) each time I do it the previous picture gets overwritten and I never end up with more than one image in the Viewer. How do I scan from the scanner and transfer the image to the Viewer object such that I'll get multiple pages in the Viewer object?

I don't want to have to program two different means of traversing backwards and forwards through the pages, since I can use DisplayNextFrame and DisplayPreviousFrame after reading in a PDF file, but then having to deal with scanned in images in a completely different way, grabbing one at a time from the Imaging object.

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

Re: Scanning multiple pages into the Viewer object?

Post by Loïc » Fri Apr 25, 2008 1:21 pm

Hi,

Using the last release of GdPicture Pro you can create easily a multipage tiff image from scanned images using an Imaging object and set this image into a GdViewer control.

ie:

Code: Select all

Dim nAcquiredImage As Long
Dim nTiffMultipage As Long
Dim nPageCount As Long

nPageCount = 0
Imaging1.TwainOpenDefaultSource
Imaging1.TwainSetAutoFeed (True)
Imaging1.TwainSetAutoScan (True)

While Imaging1.CreateImageFromTwain <> 0
      nPageCount = nPageCount + 1
      nAcquiredImage = Imaging1.GetNativeImage
      If nPageCount = 1 Then
         nTiffMultipage = Imaging1.TiffCreateMultiPageFromGdPictureImage(nAcquiredImage)
      Else
         Call Imaging1.TiffAppendPageFromGdPictureImage(nTiffMultipage, nAcquiredImage)
      End If
      Imaging1.CloseImage (nAcquiredImage)
Wend
Imaging1.TwainCloseSource

GdViewer1.SetNativeImage (nTiffMultipage)
Best regards,

Loïc Carrère

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests