trying to scan from phone camera

camiramzi

Member
Local time
Today, 18:25
Joined
Oct 30, 2022
Messages
35
Hi i use this app to scan and export to pdf from a scanner device but i want to scan with my phone this is my code for the feeder scan

Code:
With wiaScanner.Items(1)
         wiaScanner.Properties("3088").Value = 1
        .Properties("6146").Value = DLookup("[Colour]", "DPI") 'Colour intent (1 for color, 2 for grayscale, 4 for b & w)
        .Properties("6147").Value = DPI 'DPI horizontal
        .Properties("6148").Value = DPI 'DPI vertical
        .Properties("6149").Value = 0 'x point to start scan
        .Properties("6150").Value = 0 'y point to start scan
        .Properties("6151").Value = DLookup("[Horizontal]", "DPI") * DPI 'Horizontal extent -A4 = 8.5
        .Properties("6152").Value = DLookup("[Vertical]", "DPI") * DPI     'Vertical extent for letter -A4 = 11

End With

if you help i will deeply appreciate.
 
You offered a code sample out of context so it is hard to understand. For instance, what does "wiaScanner" represent? Rather obviously, you are setting scan sensitivity, image size, and color balance. But for what device?

According to a simple web search, there are many apps you can download for a phone that would make it act like a scanner. It is possible to import a picture from a phone through the DCIM folder (for Android). I don't have an Apple phone so can't tell you where the pics are in that case. If you use a picture, you don't get to control the sensitivity or size. The pictures are all .JPG format with date/time stamp as a name (times to the second), so you copy that photo to your computer then you can turn it into a .PDF in any of several ways. For instance, insert a picture in a Word document and then save that document as a .PDF - should be easy.

If you download any scanner app, be sure to get good set of documentation so you can see how to set the parameters you need. That documentation should also tell you how to link the phone and computer to make them cooperate. Without a specific product in mind, it will be hard for us to give you very much help.
 
i'm asking is it possible to take a snapshot from phone camera and images will automatically imported to access
this is the function that scans from the feeder.
Code:
Public Function feederscan()
'Must include reference to Microsoft Windows Image Acquisition 2.0 dll
On Error GoTo Handle_Err
Dim ComDialog As New wia.CommonDialog, DPI As Integer, PP As Integer, l As Integer
Dim wiaScanner As wia.Device
Dim wiaImg As wia.ImageFile
Dim intPages As Integer
Dim strFileJPG As String
Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2
Dim blnContScan As Boolean
Dim ContScan As String    'msgbox to chk if more pages are to be scanned
Dim strFilePDF As String
Dim RptName As String
Dim strProcName As String
Dim picfullname
strProcName = "ScanDocs"
blnContScan = True
Dim Counter As Integer

 'Number is 150,200,300,400,500,600,1200
    DPI = DLookup("[DPI]", "DPI")
        
        If Len(Dir(PathOfFile & Forms![Form1]![IDD], vbDirectory)) = 0 Then
            MkDir PathOfFile & Forms![Form1]![IDD]
        End If


  Set ComDialog = New wia.CommonDialog
  Set wiaScanner = ComDialog.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, False, True)
 


Counter = 0

With wiaScanner.Items(1)
         wiaScanner.Properties("3088").Value = 1
        .Properties("6146").Value = DLookup("[Colour]", "DPI") 'Colour intent (1 for color, 2 for grayscale, 4 for b & w)
        .Properties("6147").Value = DPI 'DPI horizontal
        .Properties("6148").Value = DPI 'DPI vertical
        .Properties("6149").Value = 0 'x point to start scan
        .Properties("6150").Value = 0 'y point to start scan
        .Properties("6151").Value = DLookup("[Horizontal]", "DPI") * DPI 'Horizontal extent -A4 = 8.5
        .Properties("6152").Value = DLookup("[Vertical]", "DPI") * DPI     'Vertical extent for letter -A4 = 11

End With

        
        'Start Scan if err number -2145320957 Scan document finish
        Do While Err.Number <> -2145320957 'error number is ADF status don't feed document

        On Error GoTo here
            Counter = Counter + 1
        
        picfullname = PathOfFile & Forms![Form1]![IDD] & "\" & Forms![Form1]![IDD] & "-" & Format(Now, "d-m-yy_h-n-s") & Counter & ".jpg"
'        ÎØæÉ ÓÍÈ ÇáÕæÑÉ

        Set wiaImg = wiaScanner.Items(1).Transfer(wia.FormatID.wiaFormatJPEG)


        
            wiaImg.SaveFile picfullname
        
            Set wiaImg = Nothing
            strFileJPG = ""

          ' Add full name  of pic in table images
          'Must include reference to Microsoft office 16.0 database engine object libaray
                Dim Ttb As Recordset
                Set Ttb = CurrentDb.OpenRecordset("Image")
                Ttb.AddNew
                Ttb![IDD] = Forms![Form1]![IDD]
                Ttb![Path] = picfullname
                Ttb.Update

 
Forms![Form1]![ImagesSubform].Requery

Forms![Form1]![ImagesSubform].SetFocus
DoCmd.GoToRecord , , acLast


 Loop
here:

            


Handle_Exit:

    Exit Function


Handle_Err:

    Select Case Err.Number

        Case 2501
            Resume Handle_Exit
       Case Else
            MsgBox "Oops! Something went wrong." & vbCrLf & vbCrLf & _
            "In Function:" & vbTab & strProcName & vbCrLf & _
            "Err Number: " & vbTab & Err.Number & vbCrLf & _
            "Description: " & vbTab & Err.Description, 0, _
            "Error in " & Chr$(34) & strProcName & Chr$(34)
       Resume Handle_Exit
    End Select

End Function
 
i'm asking is it possible to take a snapshot from phone camera
This depends on one major question: Is there a WIA Driver available for your phone?
If yes: Install the driver and your existing code should work without changes.
If no: You are out of luck, WIA will not work.
 

Users who are viewing this thread

Back
Top Bottom