GithubHelp home page GithubHelp logo

gege-d / pdf-doc-scan Goto Github PK

View Code? Open in Web Editor NEW

This project forked from littletrickster/pdf-doc-scan

0.0 0.0 0.0 41.87 MB

Android PDF document scanning app

License: BSD 3-Clause "New" or "Revised" License

C++ 0.01% Java 94.55% Kotlin 5.41% CMake 0.01% AIDL 0.03%

pdf-doc-scan's Introduction

PDF-Doc-Scan

Android PDF document scanning app

Main point of this app is to scan or select existing PDF documents simply using intent or chooser. Other apps require payment to access their api/sdk or simply don't have a possible way to do it. So they rely on switching between an app ,file chooser and a scanner.

Alt text

Usage Example

Create ActivityResultLauncher

val pdfResultLauncher = registerForActivityResult(StartActivityForResult()) {
    val uri = it.data?.data
    if (it.resultCode == Activity.RESULT_OK && uri != null) {
//        context.contentResolver.openInputStream(uri)
    }
}

Or using Compose

val pdfResultLauncher = rememberLauncherForActivityResult(contract = StartActivityForResult()){
    val uri = it.data?.data
    if (it.resultCode == Activity.RESULT_OK && uri != null) {
//        context.contentResolver.openInputStream(uri)
    }
}

If you target Android 11 (API level 30) and up add query to your AndroidManifest.xml to make it visible for your app.

<queries>
<package android:name="com.littletrickster.scanner" />
</queries>

Query and launch directly

val intent = Intent()
intent.component = ComponentName("com.littletrickster.scanner", "com.littletrickster.scanner.ScanActivity")
intent.action = Intent.ACTION_PICK
intent.type = "application/pdf"

val pdfInfo = context.packageManager.queryIntentActivities(intent, 0)
if (pdfInfo.firstOrNull()?.activityInfo?.enabled == true) {
    pdfResultLauncher.launch(intent)
}

Comments

Made this as a prototype while learning Compose framework in late 2021

pdf-doc-scan's People

Contributors

littletrickster avatar gregorni avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.