ask for next page with fladbled scanner

Questions, comments and suggestions concerning VintaSoft Twain ActiveX.

Moderator: Alex

Post Reply
smarelis
Posts: 2
Joined: Sun Sep 28, 2008 2:13 am

ask for next page with fladbled scanner

Post by smarelis » Sun Sep 28, 2008 2:19 am

Hi, I have an canon lide 90 flatbled scanner, i would like to add an other page to my scan process, just like a manual auto feed.
is this possible? i cannot find any information in the manual.

if so can you give me an example.
Regards
Sjaak

Alex
Site Admin
Posts: 1464
Joined: Thu Jul 10, 2008 2:21 pm

Re: ask for next page with fladbled scanner

Post by Alex » Mon Sep 29, 2008 8:46 am

Hello Sjaak,

You should enable acquisition process in a loop if you want to acquire some pages from flatbed scanner.
Here is an example:

Code: Select all

VSTwain1.appProductName = "MyTwainApplication"
If VSTwain1.StartDevice() Then
    VSTwain1.SelectSource
    VSTwain1.showUI = False
    Dim scanAnotherPath As Boolean
    scanAnotherPage = True
    While scanAnotherPage
        While VSTwain1.AcquireModal() = 1
            Set Image1.Picture = VSTwain1.GetCurrentImage()
            If VSTwain1.SaveImage(0, "c:\test.tiff") = 0 Then
                MsgBox(VSTwain1.errorString)
            End If
        Wend
        If MsgBox("Stop scan?") = MsgBoxResult.Ok Then
            scanAnotherPage = False
        End If
    Wend   
Else
    MsgBox VSTwain1.errorString
End If
Best regards, Alexander

smarelis
Posts: 2
Joined: Sun Sep 28, 2008 2:13 am

Re: ask for next page with fladbled scanner

Post by smarelis » Mon Sep 29, 2008 1:03 pm

Dear Alex,

The code worked, only the second page has an bad quality.
Can you help me with te solution?

function Scan()
{
try
{
var randomnumber=Math.floor(Math.random()*11111111111111)
var imgPath = "c:\\Scan\\" + randomnumber + ".tiff"

VSTwain1.StartDevice()
VSTwain1.maxImages=10
VSTwain1.autoCleanBuffer=1
VSTwain1.disableAfterAcquire=1
VSTwain1.transferMode = 1
VSTwain1.ShowUI=0
VSTwain1.OpenDataSource()
VSTwain1.unitOfMeasure=0
VSTwain1.pixelType=0
VSTwain1.resolution=600
VSTwain1.autoBright = 1
VSTwain1.tiffMultiPage = 1

var scanAnotherPage = 1;
var iPage = 0;
while (scanAnotherPage)
{
while (VSTwain1.AcquireModal() == 1)
{
//var Image1 = VSTwain1.GetCurrentImage();

if (VSTwain1.SaveImage(iPage, imgPath) == 0)
alert(VSTwain1.errorString)
}
if (confirm("Wilt u nog een pagina scannen?") == 0)
scanAnotherPage = 0;
iPage++
}
}
catch (e)
{
SelectScanner();
alert("Probeer opnieuw de scan opdracht uit te voeren");
}

Alex
Site Admin
Posts: 1464
Joined: Thu Jul 10, 2008 2:21 pm

Re: ask for next page with fladbled scanner

Post by Alex » Mon Sep 29, 2008 2:19 pm

You should initialize all necessary parameters for each scanned page. Here is corrected code:

Code: Select all

function Scan()
{
    try
    {
        var randomnumber=Math.floor(Math.random()*11111111111111)
        var imgPath = "c:\\Scan\\" + randomnumber + ".tiff"

        VSTwain1.StartDevice()
        VSTwain1.maxImages=10
        VSTwain1.autoCleanBuffer=1
        VSTwain1.disableAfterAcquire=1
        VSTwain1.transferMode = 1
        VSTwain1.ShowUI=0
        VSTwain1.tiffMultiPage = 1

        var scanAnotherPage = 1;
        var iPage = 0;
        while (scanAnotherPage)
        {
            VSTwain1.OpenDataSource()
            VSTwain1.unitOfMeasure=0
            VSTwain1.pixelType=0
            VSTwain1.resolution=600
            VSTwain1.autoBright = 1
            while (VSTwain1.AcquireModal() == 1)
            {
                //var Image1 = VSTwain1.GetCurrentImage();
                if (VSTwain1.SaveImage(iPage, imgPath) == 0)
                    alert(VSTwain1.errorString)
            }
            if (confirm("Wilt u nog een pagina scannen?") == 0)
                scanAnotherPage = 0;
            iPage++
        }
    }
    catch (e)
    {
        SelectScanner();
        alert("Probeer opnieuw de scan opdracht uit te voeren");
     }
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest