Add print on Zebra

main
radex 2024-02-02 21:30:04 +01:00
parent 125df83f99
commit 6eb8e4323b
Signed by: radex
SSH Key Fingerprint: SHA256:hvqRXAGG1h89yqnS+cyFTLKQbzjWD4uXIqw7Y+0ws30
2 changed files with 24 additions and 2 deletions

View File

@ -1075,6 +1075,18 @@ function file_save(maybe_saved_callback = () => { }, update_from_saved = true) {
});
}
function print_zebra() {
write_image_file(main_canvas, 'image/png', (blob) => {
console.log(blob)
fetch(`print?printer=zebra`, {
method: 'POST',
body: blob,
}).then(response => {
console.log({response})
})
});
}
function file_save_as(maybe_saved_callback = () => { }, update_from_saved = true) {
deselect();
systemHooks.showSaveFileDialog({
@ -3230,7 +3242,7 @@ function image_stretch_and_skew() {
} else {
show_error_message(localize("An unknown error has occurred."), exception);
}
// @TODO: undo and clean up undoable
// @TODO: undo and clean up undoable
return;
}
$canvas_area.trigger("resize");
@ -3573,7 +3585,7 @@ function read_image_file(blob, callback) {
} else if (detected_type_id === "tiff_be" || detected_type_id === "tiff_le") {
// IFDs = image file directories
// VSNs = ???
// This code is based on UTIF.bufferToURI
// This code is based on UTIF.bufferToURI
var ifds = UTIF.decode(arrayBuffer);
//console.log(ifds);
var vsns = ifds, ma = 0, page = vsns[0];

View File

@ -232,6 +232,16 @@
description: localize("Quits Paint."),
}
],
[localize("HSWAW")]: [
{
item: localize("Print on Zebra (large label)"),
speech_recognition: [],
action: () => {
print_zebra()
},
description: '',
},
],
[localize("&Edit")]: [
{
item: localize("&Undo"),