question

AMERSAID-7084 avatar image
0 Votes"
AMERSAID-7084 asked XingyuZhao-MSFT commented

Scan multiple pages with wia

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
dotnet-visual-basic
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AMERSAID-7084 ,
Take a look at the suggestions in the following reference:
Scaning multiple pages using WIA on windows 7
You can convert the code to vb .net.


0 Votes 0 ·

HI

XingyuZhao

I saw the code and it didn't work for me

0 Votes 0 ·

Hi @AMERSAID-7084 ,
Thanks for your feedback.
Here's another reference you can refer to (also need to convert to VB. Net):
Windows Image Acquisition (WIA) Code
Hope it could be helpful.

0 Votes 0 ·

0 Answers