Multi-Page Tiff Question

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
JoeS
Posts: 4
Joined: Fri Jul 09, 2010 10:35 pm

Multi-Page Tiff Question

Post by JoeS » Fri Jul 09, 2010 10:46 pm

Hello:
I was hoping for a little help with regard to multi-page tif files as I am completely new to GDPicture.NET. I have a program written where I can acquire from my scanner, which works no problem. I'm having a little problem saving the files though.

My situation is where I need to acquire my images in tif format, then store them on another server. Currently, I'm doing this through a web service. I would acquire the image(s) into a multi-page tif file, convert it to an array of byte, then pass that to the web service which creates the file on the server's side. For single page files, it works just fine, but for multi page files, I'm only getting the first page, and its probably because of the ImageID. I'm using some of the code from the examples:

Code: Select all

 Do
            ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
            If ImageID <> 0 Then
                nImageCount = nImageCount + 1
               If nImageCount = 1 Then
                    MultiPageID = ImageID
                    oGdPictureImaging.TiffSaveAsMultiPageFile(MultiPageID, My.Application.Info.DirectoryPath & "\multipage.tif", TiffCompression.TiffCompressionNONE)
                Else
                    oGdPictureImaging.TiffAddToMultiPageFile(MultiPageID, ImageID)
                    oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                End If
            End If
        Loop While oGdPictureImaging.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
     
        ' MultiPageID = oGdPictureImaging.TiffCreateMultiPageFromFile(My.Application.Info.DirectoryPath & "\multipage.tif")
        oGdPictureImaging.SaveAsByteArray(MultiPageID, PicBytes, BytesRead, DocumentFormat.DocumentFormatTIFF, 6)
        DL.SaveImage(PicBytes) ' Call to web service which sends the file to the server side.
        oGdPictureImaging.TiffCloseMultiPageFile(MultiPageID)
        oGdPictureImaging.TwainCloseSource()
It looks like the variable "MultiPageID" always contains the first page, so that's all I'm getting. How can I convert the whole multi-document to byte to send to the web service.

By the way, the file created ("multipage.tif") is correct and contains two pages. I've tried a few other ways like:
MultiPageID = oGdPictureImaging.TiffCreateMultiPageFromFile(My.Application.Info.DirectoryPath & "\multipage.tif")

then I would try to create the byte array from that, but it crashes the program and I'm not sure why because the crash comes from the GDPicture DLL and I can't debug that.

If there's another way to do this (send the data another way) I'm open to that. Whatever gets the job done.

Thanks,

Joe

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

Re: Multi-Page Tiff Question

Post by Loïc » Mon Jul 12, 2010 4:02 pm

Hi Joe,

Please try your code with our latest version; The SaveAsByteArray method supports multipage tiff image since few weeks only...

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests