VintaSoft Twain ActiveX Discussions

Questions, comments and suggestions concerning VintaSoft Twain ActiveX.

Board index < VintaSoft Twain < VintaSoft Twain ActiveX Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

ask for next page with fladbled scanner



ask for next page with fladbled scanner

Post by smarelis »

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


Re: ask for next page with fladbled scanner

Post by Alex »

Hello Sjaak,

You should enable acquisition process in a loop if you want to acquire some pages from flatbed scanner.
Here is an example:
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


Re: ask for next page with fladbled scanner

Post by smarelis »

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");
	}
}


Re: ask for next page with fladbled scanner

Post by Alex »

You should initialize all necessary parameters for each scanned page. Here is corrected code:
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");
     }
}


Page 1 from 1: 1