0.4.1 • Published 5 years ago
pdf417-barcode v0.4.1
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!';
}
Options
The component also accepts an opts
object with some options:
key | type | default | description |
---|---|---|---|
aspect | float | 4 | aspect ratio of the generated barcode |
errlvl | -1 .. 8 | -1 | error correction level in the barcode, -1 means auto |
pxw | float | 1 | pixel width |
pxh | float | 1 | pixel height |
You can use property binding directly like this:
<pdf417barcode [text]="'Hello, World!'" [opts]="{ pxw: 2, pxh: 2 }"></pdf417barcode>