Skip to content

Support for pfd417 #97

@portomartin

Description

@portomartin

pdf417(msg) {

	/** add */
	function add(arrayValues) {
		data.push(arrayValues);
	};

	var data = [];

	/** ESC POS */
	add([27, 116, 12]);

	/** QR Code: Select the model f=165 */
	add([0x1D, 0x28, 0x6B, 0x04, 0x00, 0x31, 0x41, 0x32, 0x00]);

	/** PDF417: Set the width of the module f=067 */
	add([0x1D, 0x28, 0x6B, 0x03, 0x00, 0x30, 0x43, 0x04]);

	/** PDF417: Set the row height f=068 */
	add([0x1D, 0x28, 0x6B, 0x03, 0x00, 0x30, 0x44, 0x01]);

	/** PDF417: Set the error correction level f=069 */
	add([0x1D, 0x28, 0x6B, 0x04, 0x00, 0x30, 0x45, 0x31, 0x00]);

	/** PDF417: Select the options f=070 */
	add([0x1D, 0x28, 0x6B, 0x03, 0x00, 0x30, 0x46, 0x00]);

	/** PDF417: Store the data in the symbol storage area f=080 */
	var dataLen = msg.length + 3;
	add([0x1D, 0x28, 0x6B, dataLen, 0x00, 0x30, 0x50, 0x30]);

	/** add content */
	var dataArray = [];
	for (var z in msg) {
		var letter = msg[z].charCodeAt(0);
		dataArray.push(letter);
	}
	add(dataArray);

	/** PDF417: Print the symbol data in the symbol storage area f=081 */
	add([0x1D, 0x28, 0x6B, 0x03, 0x00, 0x30, 0x51, 0x30]);
	
	/** write buffer */
	for (var x in data) {
		for (var y in data[x]) {
			this.buffer.writeUInt8(data[x][y]);
		}
	}

	return this;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions