Page 1 of 1

Scan Multipe Single Pages to 1 PDF

Posted: Tue Jul 08, 2008 9:27 pm
by uccu
Is it possible to scan mulitple duplexed single Page documents into 1 PDF. I am going to guess and say that it is.

Is it as simple as not closing the image file and scanning the next document and then using the TwainAddGdPictureImageToPdf or is it a little more involved?

Re: Scan Multipe Single Pages to 1 PDF

Posted: Wed Jul 09, 2008 4:03 pm
by Loïc
Hi,

This is a code snipet to acquire all the document feeder into one multipage pdf file using duplex scanning mode:

Code: Select all

Twain1.TwainOpenDefaultSource
Twain1.TwainSetAutoFeed (True)
Twain1.TwainSetAutoScan (True)
Twain1.TwainEnableDuplex (True)
Twain1.TwainPdfStart ("output.pdf")
While Twain1.TwainAcquireToGdPictureImage(Me.hWnd) <> 0
      Call Twain1.TwainAddGdPictureImageToPdf(Twain1.GetNativeImage)
      Twain1.CloseNativeImage
Wend
Twain1.TwainPdfStop
Call Twain1.TwainCloseSource
Best regards,

Loïc

Re: Scan Multipe Single Pages to 1 PDF

Posted: Wed Jul 09, 2008 5:30 pm
by uccu
Loïc

I forgot to mention that there is no Document Feeder on this scanner.

Re: Scan Multipe Single Pages to 1 PDF

Posted: Wed Jul 09, 2008 5:40 pm
by Loïc
Hi,

It is the same kind of code:


First Step: Open the Scanner & Initialize the output PDF

Code: Select all

Twain1.TwainOpenDefaultSource
Twain1.TwainEnableDuplex (True)
Twain1.TwainPdfStart ("output.pdf")

Second Step: Acquire each image in duplex mode. Repeat this step for each image to scan

Code: Select all

'Front
Twain1.TwainAcquireToGdPictureImage(Me.hWnd)
Call Twain1.TwainAddGdPictureImageToPdf(Twain1.GetNativeImage)
Twain1.CloseNativeImage

'Back
Twain1.TwainAcquireToGdPictureImage(Me.hWnd)
Call Twain1.TwainAddGdPictureImageToPdf(Twain1.GetNativeImage)
Twain1.CloseNativeImage

Last Step: Save PDF & close the scanner

Code: Select all

Twain1.TwainPdfStop
Call Twain1.TwainCloseSource

Loïc