Skip to content

📋 Ionic app to read bar codes. Another excellent tutorial from Simon Grimm at the Ionic Academy

License

Notifications You must be signed in to change notification settings

AndrewJBateman/ionic-angular-qrreader

Repository files navigation

⚡ Ionic Angular QR Bar Code Reader

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • Generates QR bar codes from input text (a web address in this case) as the text is typed.
  • Note: ngx-qrcode2 has been deprecated. @techiediaries/ngx-qrcode should be used instead.

📷 Screenshots

image

📶 Technologies

💾 Setup

  • Run npm i to install dependencies
  • To start the server on localhost://8100 type: 'ionic serve'

💻 Code Examples

  • function to download bar code data.
 downloadQR() {
    const canvas = document.querySelector('canvas') as HTMLCanvasElement;
    const imageData = canvas.toDataURL('image/jpeg').toString();
    console.log('data: ', imageData);

    let data = imageData.split(',')[1];

    this.base64ToGallery.base64ToGallery(data,
      { prefix: '_img', mediaScanner: true })
      .then(async res => {
        let toast = await this.toastCtrl.create({
          header: 'QR code saved to Photolibrary'
        });
        toast.present();
    }, err => console.log('err: ', err))
  };

🆒 Features

  • Uses phone camera to scan a bar code.
  • saves bar code images to phone photo library.

📋 Status & To-do list

  • Status: Compiles in browser but needs to be tested on a mobile simulator
  • To-do: Test in Android Studio

👏 Inspiration

📁 License

  • This project is licensed under the terms of the MIT license.

✉️ Contact