Add the pdf417 plugin to your project:
cd <path_to_your_project> cordova plugin add https://github.com/alejonext/pdf417-phonegap
Add Android platform support to the project:
cordova platform add android
Add iOS plaform support to the project:
cordova platform add ios
Windows Phone 8.0
Add Windows Phone 8.0 support to the project:
cordova platform add wp8
Pdf417/src/wp8/lib/Microblink.dll file to
Plugins/mobi.Pdf417.Pdf417Scanner/ folder in your new project.
Here's a complete example of how to create and build a project for Android, iOS and Windows Phone 8.0 using cordova (you can substitute equivalent commands for phonegap):
cordova create testcordovacd testcordova# add the pdf417 plugincordova plugin add https://github.com/alejonext/pdf417-phonegap# add android support to the projectcordova platform add android# build the project, the binary will appear in the bin/ foldercordova build android# add ios support to the projectcordova platform add ios# build the projectcordova build ios# add windows phone 8.0 support to the projectcordova platform add wp8# build the projectcordova build wp8# copy the Microblink.dll file to location in project as described above
In phonegap CLI instead of "platform add" just request a build for the platform using "build android" or "build ios" or "build wp8". You will have to do the manual steps described above to be able to do a successfull build.
/*** Scan these barcode types* Available: "PDF417", "USDL", "QR Code", "Code 128", "Code 39", "EAN 13", "EAN 8", "ITF", "UPCA", "UPCE"*/var types = "USDL" "QR Code";/*** Initiate scan with options* NOTE: Some features are unavailable without a license* Obtain your key at*/var options =beep : true // Beep onnoDialog : true // Skip confirm dialog after scanuncertain : false //RecommendedquietZone : false //RecommendedhighRes : false //RecommendedinverseScanning: falsefrontFace : false;// Note that each platform requires its own license key// This license key allows setting overlay views for this application ID: mobi.pdf417.demovar licenseiOs = "RZNIT6NY-YUY2L44B-JY4C3TC7-LE5LFU2B-JOAF4FO3-L5MTVMWT-IFFYAXQV-3NPQQA4G";// This license is only valid for package name "mobi.pdf417.demo"var licenseAndroid = "UDPICR2T-RA2LGTSD-YTEONPSJ-LE4WWOWC-5ICAIBAE-AQCAIBAE-AQCAIBAE-AQCFKMFM";// This license is only valid for Product ID "e2994220-6b3d-11e5-a1d6-4be717ee9e23"var licenseWP8 = "5JKGDHZK-5WN4KMQO-6TZU3KDQ-I4YN67V5-XSN4FFS3-OZFAXHK7-EMETU6XD-EY74TM4T";scanButton;
Available barcode types for the scanner are:
- QR Code
- Code 128
- Code 39
- EAN 13
- EAN 8
Additionally, USDL parsing is available when types array contains "USDL" string.
The following options are available:
- beep - Boolean - set to true to play beep sound after successful scan
- noDialog - Boolean - set to true to show confirm dialog after successful scan (license required)
- removeOverlay - Boolean - set to true to remove Pdf417.mobi logo overlay on scan (license required)
- uncertain - Boolean - set to true to scan even barcode not compliant with standards. For example, malformed PDF417 barcodes which were incorrectly encoded. Use only if necessary because it slows down the recognition process
- quietZone - Boolean - set to true to scan barcodes which don't have quiet zone (white area) around it. Use only if necessary because it drastically slows down the recognition process
- highRes - Boolean - Set to true if you want to always use highest possible camera resolution (enabled by default for all devices that support at least 720p camera preview frame size)
- frontFace - Boolean - to use front facing camera. Note that front facing cameras do not have autofocus support, so it will not be possible to scan denser and smaller codes.
All license parameters must be provided (for iOS and Android and WP8) even if you do not plan to run the application on both platforms. The licenses that you do not have/use must be set to
How to get started
- Download PDF417.mobi PhoneGap SDK, and try the sample app for iOS, Android or Windows Phone 8.0.
Sample app is generated with a script
To run iOS demo application open Xcode project Pdf417Demo.xcodeproj
To run Android demo application type
cordova run android
To run Windows Phone demo application open Visual Studio solution Pdf417Demo.sln