Scan multiple pages with wia

AMER SAID 396 Reputation points
2021-07-12T19:24:23.303+00:00

hi

how to Scan multiple pages with wia. scanner name fujitsu fi7160. Where the scanner pulls more than one document and shows them as a PDF file. I want to display the path of the file after the scanneing work and change the folder to save the PDF file.

scan one image from scanner with wia and work done

 Dim dlg = New WIA.CommonDialog()
        Dim imagefile As ImageFile = dlg.ShowAcquireImage(DeviceType:=WiaDeviceType.ScannerDeviceType, Intent:=WiaImageIntent.ColorIntent, Bias:=WiaImageBias.MinimizeSize,
                                                FormatID:=WIA.FormatID.wiaFormatJPEG, AlwaysSelectDevice:=True, UseCommonUI:=True, CancelError:=False)
        Dim sPath As String = "e:\testscan.jpg"
        If (imagefile IsNot Nothing) Then
            Dim v As Vector = imagefile.FileData
            Dim bytes As Byte() = v.BinaryData()
            Using ms = New IO.MemoryStream(bytes)
                Using bitmap = New Bitmap(ms)
                    Dim codecinfo As ImageCodecInfo = ImageCodecInfo.GetImageDecoders.First(Function(name) name.FormatID = ImageFormat.Jpeg.Guid)
#Disable Warning BC42025 ' Access of shared member, constant member, enum member or nested type through an instance
                    Dim encoder As Imaging.Encoder = encoder.Quality
#Enable Warning BC42025 ' Access of shared member, constant member, enum member or nested type through an instance
                    Dim ep As EncoderParameters = New EncoderParameters(1)
                    Dim qualityParameter As EncoderParameter = New EncoderParameter(encoder, 75L)
                    ep.Param(0) = qualityParameter
                    bitmap.Save(sPath, codecinfo, ep)
                End Using
            End Using
        End If
Developer technologies | VB
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.