0.4.1 • Published 5 years ago

pdf417-barcode v0.4.1

Weekly downloads
17
License
LGPL-3.0
Repository
github
Last release
5 years ago

Angular PDF417 Barcode

An Angular component/module that creates a canvas with a PDF417 barcode from a string input.

Install

Use it in your Angular project by installing with yarn or npm:

yarn add pdf417-barcode

Usage

In a parent or shared module, import the Pdf417BarcodeModule, which imports the Component and Declaration.

[...]
import { Pdf417BarcodeModule } from "pdf417-barcode";

@NgModule({
  ...
  imports: [
    ...
    Pdf417BarcodeModule,
  ],
  ...
})
export class AppModule { }

Then use it in your own component's template:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  template: `
    <div>
      <h5>Scan Me:</h5>
      <pdf417barcode [text]="text" [opts]="{ pxw: 2, pxh: 2 }"></pdf417barcode>
    </div>
  `,
})
export class AppComponent {
  public text = 'Hello, World!';
}

barcode

Options

The component also accepts an opts object with some options:

keytypedefaultdescription
aspectfloat4aspect ratio of the generated barcode
errlvl-1 .. 8-1error correction level in the barcode, -1 means auto
pxwfloat1pixel width
pxhfloat1pixel height

You can use property binding directly like this:

<pdf417barcode [text]="'Hello, World!'" [opts]="{ pxw: 2, pxh: 2 }"></pdf417barcode>