Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
pdf417-cordova
Advanced tools
This repository contains example wrapper for PDF417 native SDKs (iOS and Android). Not all features of native SDKs are available in PhoneGap wrapper. However, the wrapper is open source, so you can easily add features that you need. For 100% of features and maximum control, consider using native SDKs.
First generate an empty project if needed:
cordova create <path> <package> <name>
The shown instructions are for Cordova, the instructions for PhoneGap are practically the same, except for some slight command line argument differences.
Add the pdf417 plugin to your project:
cd <path_to_your_project>
cordova plugin add <pdf417_plugin_path> # or pdf417-cordova if you don't have pdf417-phonegap locally
Add Android platform support to the project:
cordova platform add android
If you want to add iOS as a platform for your application, you will need to install unzip and wget. Currently cordova plugin uses a hook script, that runs before adding ios platform, to download pdf417 framework and bundle from github.
Add iOS plaform support to the project:
cordova platform add ios
Here's a complete example of how to create and build a project for Android and iOS using cordova (you can substitute equivalent commands for phonegap):
# pull the plugin and sample application from Github
git clone https://github.com/PDF417/pdf417-phonegap.git
# initialize and update submodules
git submodule init
git submodule update
# create a empty application
cordova create testcordova
cd testcordova
# add the pdf417 plugin
cordova plugin add ../pdf417-phonegap/Pdf417
# add android support to the project
cordova platform add android@7
# build the project, the binary will appear in the bin/ folder
cordova build android
# add ios support to the project
cordova platform add ios
# build the project
cordova build ios
In phonegap CLI instead of "platform add" just request a build for the platform using "build android" or "build ios". You will have to do the manual steps described above to be able to do a successfull build.
You can also use provided initDemoApp.sh
script that will generate a demo app that uses the plugin:
./initDemoApp.sh
To run the script, you'll need BASH environment on Windows (Linux and MacOS use BASH by default).
To use the plugin you call it in your Javascript code like the demo application:
/**
* Scan these barcode types
* Available: "PDF417", "USDL", "QR Code", "Code 128", "Code 39", "EAN 13", "EAN 8", "ITF", "UPCA", "UPCE", "Aztec", "Data Matrix"
*/
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, // Beep on
noDialog : true, // Skip confirm dialog after scan
uncertain : false, //Recommended
quietZone : false, //Recommended
highRes : false, //Recommended
inverseScanning: false,
frontFace : false
};
// Note that each platform requires its own license key
// This license key allows setting overlay views for this application ID: mobi.pdf417.demo
// Valid until 2018-06-04
var licenseiOs = "sRwAAAEQbW9iaS5wZGY0MTcuZGVtbz/roBZ34ygXMQRMupTjSPXnoj0Mz1jPfk1iRX7f78Ux6a+pfXVyW0HCjPTxl5ocxgXWF66PTrtFUbJFCDUpyznreSWY4akvhvqVFfcTYgVEKjB+UqO6vPD5iIaUCaEYhF4dVmM=";
// This license is only valid for package name "mobi.pdf417.demo"
var licenseAndroid = "sRwAAAAQbW9iaS5wZGY0MTcuZGVtb2uCzTSwE5Pixw1pJL5UEN7nyXbOdXB61Ysy/sgAYt4SaB0T/g6JvisLn6HtB8LzLDmpFjULMxmB8iLsy3tFdHtMhLWOM6pr0tQmSLGyhrXfe6rVoHAxJtPrFEoCNTk4RjLltQ==";
scanButton.addEventListener('click', function() {
cordova.plugins.pdf417Scanner.scan(
// Register the callback handler
function callback(scanningResult) {
// handle cancelled scanning
if (scanningResult.cancelled == true) {
resultDiv.innerHTML = "Cancelled!";
return;
}
// Obtain list of recognizer results
var resultList = scanningResult.resultList;
var resToShow = "";
// Iterate through all results
for (var i = 0; i < resultList.length; i++) {
// Get individual resilt
var recognizerResult = resultList[i];
resToShow += "(Result type: " + recognizerResult.resultType + ") <br>"
if (recognizerResult.resultType == "Barcode result") {
// handle Barcode scanning result
var raw = "";
if (typeof(recognizerResult.raw) != "undefined" && recognizerResult.raw != null) {
raw = " (raw: " + hex2a(recognizerResult.raw) + ")";
}
resToShow += "(Barcode type: " + recognizerResult.type + ")<br>"
+ "Data: " + recognizerResult.data + "<br>"
+ raw;
} else if (recognizerResult.resultType == "USDL result") {
// handle USDL parsing result
var fields = recognizerResult.fields;
resToShow += /** Personal information */
"USDL version: " + fields[kPPStandardVersionNumber] + "; " +
"Family name: " + fields[kPPCustomerFamilyName] + "; " +
"First name: " + fields[kPPCustomerFirstName] + "; " +
"Date of birth: " + fields[kPPDateOfBirth] + "; " +
"Sex: " + fields[kPPSex] + "; " +
"Eye color: " + fields[kPPEyeColor] + "; " +
"Height: " + fields[kPPHeight] + "; " +
"Street: " + fields[kPPAddressStreet] + "; " +
"City: " + fields[kPPAddressCity] + "; " +
"Jurisdiction: " + fields[kPPAddressJurisdictionCode] + "; " +
"Postal code: " + fields[kPPAddressPostalCode] + "; " +
/** License information */
"Issue date: " + fields[kPPDocumentIssueDate] + "; " +
"Expiration date: " + fields[kPPDocumentExpirationDate] + "; " +
"Issuer ID: " + fields[kPPIssuerIdentificationNumber] + "; " +
"Jurisdiction version: " + fields[kPPJurisdictionVersionNumber] + "; " +
"Vehicle class: " + fields[kPPJurisdictionVehicleClass] + "; " +
"Restrictions: " + fields[kPPJurisdictionRestrictionCodes] + "; " +
"Endorsments: " + fields[kPPJurisdictionEndorsementCodes] + "; " +
"Customer ID: " + fields[kPPCustomerIdNumber] + "; ";
}
resToShow += "<br><br>";
}
resultDiv.innerHTML = resToShow;
},
// Register the error callback
function errorHandler(err) {
alert('Error: ' + err);
},
types, options, licenseiOs, licenseAndroid
);
});
Available barcode types for the scanner are:
Additionally, USDL parsing is available when types array contains "USDL" string.
The following options are available:
All license parameters must be provided (for iOS and Android) 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 null
.
For obtaining US Driver's license parsing result, see the sample code above, and usdl_keys.js javascript file which contains information about values which you can obtain from scanned USDL.
Sample app is generated with a script
./initDemoApp.sh
To run iOS demo application open Xcode project Pdf417Demo.xcodeproj
To run Android demo application type
cd PDF417Demo
cordova run android
Generate a free demo license key to start using the SDK in your app (registration required)
Get information about pricing and licensing od microblink.com
FAQs
A small and powerful PDF417 barcode scanning library
We found that pdf417-cordova demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.