Giter VIP home page Giter VIP logo

pdf417-phonegap25's Introduction

pdf417-phonegap25

Backport of Pdf417 Plugin to Phonegap 2.5.0

Android

Copy from AndroidPlugin folder:

  • contents of AndroidPlugin/res to your Android project res folder
  • contents of AndroidPlugin/libs to your Android project libs folder
  • folder AndroidPlugin/com/* to your Android project src folder
  • pdf417scanner.js to your Android project assets/www folder

Add permissions and activities to your AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />        

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />
<uses-feature android:glEsVersion="0x00020000" android:required="false" />

....

<activity
    android:name="mobi.pdf417.activity.Pdf417ScanActivity"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:screenOrientation="portrait" >
    <intent-filter>
        <action android:name="mobi.pdf417.activity.Pdf417ScanActivity" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

In your res/xml/config.xml file add the following line:

<plugin name="Pdf417Scanner" value="com.phonegap.plugins.pdf417.Pdf417Scanner"/>

Include a reference to plugin JavaScript file:

<script type="text/javascript" src="pdf417scanner.js"></script>

Define options and license keys before starting a scan:

    **
    * Scan these barcode types
    * Available: "PDF417", "QR Code", "Code 128", "Code 39", "EAN 13", "EAN 8", "ITF", "UPCA", "UPCE"
    **/
    var types = ["PDF417", "QR Code"];

    /**
    * Initiate scan with options
    * NOTE: Some features are unavailable without a license
    * Obtain your key at http://pdf417.mobi
    **/
    var options = {
        beep : true,
        noDialog : true,
        removeOverlay :true,
        uncertain : false, //Recommended
        quietZone : false, //Recommended
        highRes : false, //Recommended
        frontFace : false
    };

    // Note that each platform requires its own license key

    // This license key allows setting overlay views for this application ID: net.photopay.barcode.pdf417-sample
    var licenseiOs = "YHCP-25S4-ZFR3-3LQR-ANPY-MZFZ-VVHO-YPUW";

    // This license is only valid for package name "mobi.pdf417"
    var licenseAndroid = "FFMV-RULX-VNIU-CSJW-DAC6-JRBU-AKOC-ZV3G";       

Open scan activity like this:

    window.plugins.pdf417Scanner.scanWithOptions(
        // Register the callback handler
        function callback(data) {
            //alert("got result " + data.data + " type " + data.type);
            if (data.cancelled == true) {
                resultDiv.innerHTML = "Cancelled!";
            } else {
                resultDiv.innerHTML = "Data: " + data.data + " (raw: " + hex2a(data.raw) + ") (Type: " + data.type + ")";
            }
        },
        // Register the errorHandler
        function errorHandler(err) {
            alert('Error');
        },
        types, options, licenseiOs, licenseAndroid
    );

See more detailed documentation at https://github.com/PDF417/pdf417-phonegap/tree/dev#usage

pdf417-phonegap25's People

Contributors

lhabjane 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.