i try to print a label using qz tray, my technical specs were :
- React web apps
- Get data from API and then render it as html element, using html2pdf.js convert it as pdf
- Convert the pdf to base64 string and feed it to qz tray
- I can see the html element as well the pdf output. All is good quality.
Problem is, the label output have a CODE128 barcode and when i try to scan it, it's not readable. I have try to scan the pdf one, and it works fine. Have try to tweak the html, html2pdf.js config and qz, but it looks like the output never in a hi-res output.
my qz tray code :
const qzPrinter = qz.printers.find("Wincode C342 (Copy 3)");
const funcUpdateLoading = this.updateLoading;
qzPrinter().then(function(printer) {
let objPrinter = printer;
var config = qz.configs.create(objPrinter, {
margins: { left: 0.1, bottom: 0.1 }
});
var source = window.document.getElementById("dummyAwb").innerHTML;
var opt = {
margin: [0,0],
filename: "myfile.pdf",
image: { type: "jpeg", quality: 1 },
html2canvas: { dpi: 192, letterRendering: true },
jsPDF: { unit: "mm", format: [365, 305], orientation: "portrait" },
pagebreak: { mode: "avoid-all", before: ".akhirTable" }
};
html2pdf()
.set(opt)
.from(source)
.toPdf()
.output("datauristring")
.then(function(pdfAsString) {
let arrStr = pdfAsString.split(",");
var data = [
{
type: "pdf",
format: "base64",
data: arrStr[1]
}
];
qz.print(config, data).then(function() {
funcUpdateLoading();
});
});
});
Can please someone pointed out, how to adjust the quality in qz tray ? TIA