1.3.2 • Published 2 years ago

ticket2canvas v1.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

ticket2canvas

Paint ticket in canvas and you can export it as Base64 string

useage

import ticket2canvas from "ticket2canvas";
ticket2canvas({
    /* option according below */
});

option

{
    el: "#cvs", // target canvas id. append to body if empty
    showCanvas: true, // whether show the default canvas, default is false
    json: {
        width: 100, // canvas's width, default is 300
        height: 200, // canvas's height, default is 600
        printData: [
            // contents to print
            {
                type: "text", // content type, allow 'text'|'barcode'|'qrcode'|'line'
                content: "hello world",
                fontSize: 16, // font-size, it's a Number-type, default is 16
                fontFamily: "Microsoft YaHei", // fontFamily, default is 'Microsoft YaHei'
                bold: true, // whether the font is bold
                width: 200, // only use for 'barcode'|'qrcode'|'line', default is 100
                height: 200, // only use for 'barcode'|'qrcode'|'line', default is 100
                left: 20, // content's left margin to canvas, default is 0
                top: 20, // content's top margin to canvas, default is 0
            },
        ],
    }
};

live demo

This is a live demo: ticket2canvas-demo

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago