Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for pfd417 #97

Open
MoaLaiSkirulais opened this issue Aug 25, 2024 · 0 comments
Open

Support for pfd417 #97

MoaLaiSkirulais opened this issue Aug 25, 2024 · 0 comments

Comments

@MoaLaiSkirulais
Copy link


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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant