PDF417 Mobile SDK

PDF417 allows scanning of popular 1D and 2D barcode types. For standardized barcodes such as SEPA payment barcode, PDF417 also features parsing. The list of supported barcodes includes PDF417, QR code, DataMarix, Code128, and many others.

Go to PDF417 product page

Code, documentation and integration guide are available on our Github repositories below. To get your free time-limited demo license key, register on our developer dashboard.

Download free PDF417 demo app

With PDF417 you can scan various barcodes and QR codes.

Integration samples

Copy to clipboard
#import <MicroBlink/MicroBlink.h>

@interface ViewController () <MBBarcodeOverlayViewControllerDelegate>

@property (nonatomic, strong) MBBarcodeRecognizer *barcodeRecognizer;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    /** First, set license key as soon as possible */
    [[MBMicroblinkSDK sharedInstance] setLicenseResource:@"<name>" withExtension:@"<extension>" inSubdirectory:@"<subdirectory>" forBundle:<bundle>];
}

- (IBAction)didTapScan:(id)sender {
    
     /** Create recognizers */
    // various 1D and 2D barcode types are supported,
    // see https://bit.ly/2pFDYpQ for options
    self.barcodeRecognizer = [[MBBarcodeRecognizer alloc] init];
    
    // only PDF417 2D barcode will be activated
    self.barcodeRecognizer.scanPdf417 = YES;
       
    MBBarcodeOverlaySettings* settings = [[MBBarcodeOverlaySettings alloc] init];
    
    NSMutableArray<MBRecognizer *> *recognizers = [[NSMutableArray alloc] init];

    [recognizers addObject:self.barcodeRecognizer];
    
    /** Create recognizer collection */
    settings.uiSettings.recognizerCollection = [[MBRecognizerCollection alloc] initWithRecognizers:recognizers];
    
    MBBarcodeOverlayViewController *overlayVC = [[MBBarcodeOverlayViewController alloc] initWithSettings:settings andDelegate:self];
    UIViewController<MBRecognizerRunnerViewController>* recognizerRunnerViewController = [MBViewControllerFactory recognizerRunnerViewControllerWithOverlayViewController:overlayVC];
    
    /** Present the recognizer runner view controller. You can use other presentation methods as well (instead of presentViewController) */
    [self presentViewController:recognizerRunnerViewController animated:YES completion:nil];
}

#pragma mark - MBBarcodeOverlayViewControllerDelegate

- (void)barcodeOverlayViewControllerDidFinishScanning:(nonnull MBBarcodeOverlayViewController *)barcodeOverlayViewController state:(MBRecognizerResultState)state {
    
     /** This is done on background thread*/
    [overlayViewController.recognizerRunnerViewController pauseScanning];
    
    if (self.barcodeRecognizer.result.resultState == MBRecognizerResultStateValid) {
      /** Needs to be called on main thread because everything prior is on background thread */
      dispatch_async(dispatch_get_main_queue(), ^{
          // result is valid, you can use it however you wish
      });
    }
}

- (void)barcodeOverlayViewControllerDidTapClose:(nonnull MBBarcodeOverlayViewController *)barcodeOverlayViewController {
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
Copy to clipboard
import MicroBlink

class ViewController: UIViewController, MBBarcodeOverlayViewControllerDelegate {
    
    var barcodeRecognizer : MBBarcodeRecognizer?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        MBMicroblinkSDK.sharedInstance().setLicenseResource("<name>", withExtension: "<extension>", inSubdirectory: "<subdirectory>", for: <bundle>)
    }
    
    @IBAction func didTapScan(_ sender: AnyObject) {
        
        /** Create barcode recognizer */
        // various 1D and 2D barcode types are supported,
        // see https://bit.ly/2pFDYpQ for options
        self.barcodeRecognizer = MBBarcodeRecognizer()
        
        // only PDF417 2D barcode will be activated
        self.barcodeRecognizer?.scanPdf417 = true
                
        /** Create barcode settings */
        let settings : MBBarcodeOverlaySettings = MBBarcodeOverlaySettings()
        
        /** Crate recognizer collection */
        let recognizerList : Array = [self.barcodeRecognizer!] as! [MBRecognizer]
        let recognizerCollection : MBRecognizerCollection = MBRecognizerCollection(recognizers: recognizerList)
        
        /** Add recognizer collection to barcode settings */
        settings.uiSettings.recognizerCollection = recognizerCollection
        
        /** Create your overlay view controller */
        let barcodeOverlayViewController : MBBarcodeOverlayViewController = MBBarcodeOverlayViewController(settings: settings, andDelegate: self)
        
        /** Create recognizer view controller with wanted overlay view controller */
        let recognizerRunneViewController : UIViewController = MBViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: barcodeOverlayViewController)
        
        /** Present the recognizer runner view controller. You can use other presentation methods as well (instead of presentViewController) */
        self.present(recognizerRunneViewController, animated: true, completion: nil)
    }
    
    
    // MARK: MBBarcodeOverlayViewControllerDelegate
    
    func barcodeOverlayViewControllerDidFinishScanning(_ barcodeOverlayViewController: MBBarcodeOverlayViewController, state: MBRecognizerResultState) {
        
        let recognizerRunnerViewController = overlayViewController.recognizerRunnerViewController as MBRecognizerRunnerViewController
        
        if (self.barcodeRecognizer!.result.resultState == MBRecognizerResultState.valid) {
          /** This is done on background thread */
          recognizerRunnerViewController.pauseScanning()
          
          /** Needs to be called on main thread because everything prior is on background thread */
          DispatchQueue.main.async {
            // result is valid, you can use it however you wish
              
          }
        }
    }
    
    func barcodeOverlayViewControllerDidTapClose(_ barcodeOverlayViewController: MBBarcodeOverlayViewController) {
        self.overlayViewControllerDidTapClose(barcodeOverlayViewController)
        
        self.dismiss(animated: true, completion: nil)
    }
}
Copy to clipboard
/**
 * Set your license file. The recommended way is extending the Android Application class
 * and setting the license file in its onCreate callback.
 * Register on our dashboard to get the license key for your app.
 */
public class MyApplication extends Application {
    @Override
    public void onCreate() {
        MicroblinkSDK.setLicenseFile("path/to/license/file/within/assets/dir", this);
    }
}

public class MyActivity extends Activity {
    private BarcodeRecognizer mBarcodeRecognizer;
    private RecognizerBundle mRecognizerBundle;
    
    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        
        // setup views, as you would normally do in onCreate callback
        
        // create BarcodeRecognizer
        // various 1D and 2D barcode types are supported,
        // see https://bit.ly/2Gf5f8M for options
        mBarcodeRecognizer = new BarcodeRecognizer();
      
        // only PDF417 2D barcode will be activated
        mBarcodeRecognizer.setScanPDF417(true);
        
        // bundle recognizers into RecognizerBundle
        mRecognizerBundle = new RecognizerBundle(mBarcodeRecognizer);
    }
  
    public void startScanning() {
        // Settings for BarcodeScanActivity Activity
        BarcodeUISettings settings = new BarcodeUISettings(mRecognizerBundle);
    
        // tweak settings as you wish
    
        // Start activity
        ActivityRunner.startActivityForResult(this, MY_REQUEST_CODE, settings);
    }
  
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == MY_REQUEST_CODE) {
            if (resultCode == BarcodeScanActivity.RESULT_OK && data != null) {
                // load the data into all recognizers bundled within your RecognizerBundle
                mRecognizerBundle.loadFromIntent(data);

                // now every recognizer object that was bundled within RecognizerBundle
                // has been updated with results obtained during the scanning session

                // you can get the result by invoking getResult on recognizer
                BarcodeRecognizer.Result result = mBarcodeRecognizer.getResult();
                if (result.getResultState() == Recognizer.Result.State.Valid) {
                    // result is valid, you can use it however you wish
                }
            }
        }
    }

}