Methods
labelmake({template, inputs, font})
Source codeFunction to create PDF. Works on Node and Browser.
Parameters:
Name | Type | Description |
---|---|---|
template | Template | Base PDF data and variable area data schema for PDF. |
inputs | { [key: string]: string }[] | Key, value objects corresponding to variable area data schema defined in template. and elements of array correspond to page. (if input type is barcode or image, then please omit barcode's checksum and image is a JPEG, PNG Base64 encoded character string) |
font | { [key: string]: string | Uint8Array | ArrayBuffer } | optional Key is corresponding to fontName defined in template or template's schema. value is data of font file (ttf). Default is Helvetica font. |
Returns:
Promise<Uint8Array> Promise object represents the uint8Array of PDF.
Types
Template
Source codeBase PDF data and variable area data schema for PDF.
Properties:
Name | Type | Description |
---|---|---|
basePdf | string | Uint8Array | ArrayBuffer | { height: number; width: number; } | Fixed area PDF data. *In the case of a string, it is a base64 encoded string. *Height and width are specified in mm |
schemas | { [key: string]: TemplateSchema }[] | Variable area data. The key corresponds to the key in inputs and elements of array correspond to page. |
fontName | string | optional Font object key in labelmake function parameter. Default is Helvetica font. |
TemplateSchema
Source codeVariable area data schema for Template.
Properties:
Name | Type | Description |
---|---|---|
type | "text" | "image" | "qrcode" | "japanpost" | "ean8" | "ean13" | "code39" | "code128" | "nw7" | "itf14" | "upca" | "upce" | Input Type of variable area. Text, images and various barcodes are available. |
width | number | Width of variable area. (Unit is mm) |
height | number | Height of variable area. (Unit is mm) |
position | { x: number; y: number; } | Position of variable area. (Unit is mm) |
rotate | number | optional Rotate of variable area. Default is 0. |
alignment | "left" | "right" | "center" | optional Used when type is "text". Default is left. |
fontName | string | optional Used when type is "text". Font object key in labelmake function parameter. Default is Template's fontName . |
fontSize | number | optional Used when type is "text". Default is 13.(Unit is pt) |
fontColor | string | optional Used when type is "text". Default is #000. |
characterSpacing | number | optional Used when type is "text". Default is 0.(Unit is pt) |
lineHeight | number | optional Used when type is "text". Default is 1. (Unit is em) |