Here's the code I'm using to generate the label:
var printerName = qzPrinters[7];
var options = {
orientation: 'landscape'
};
var config = qz.configs.create(printerName, options);
var html = "<!DOCTYPE html><html><body><div><table><tr><td><span style='font-size: 8pt;'>Class:</span><span style='font-size: 12pt;'> {classname}</span></td>></td></tr><tr><td align='center' colspan='2' style='font-size: 26pt;'>{firstname}</td></tr><tr><td align='center' colspan='2' style='font-size: 18pt;'>{lastname}</td></tr><tr><td rowspan='2' style='font-size: 24pt;'>{allergies}</td><td><table><tr><td style='font-size: 8pt;'>Security Code:</td><td style='font-size: 24pt;'>{securitycode}</td></tr><tr><td style='font-size: 8pt;'>Bag Count:</td><td style='font-size: 24pt;'>{bagcount}</td></tr></table></td></tr></table></div></body></html>";
var data = [{
type: 'html',
format: 'plain',
data: html
}];
qz.print(config, data).catch(function (e) { console.error(e); });
I'm not having much luck getting anything more than gibberish to print. Here's a JSFiddle of my desired output: https://jsfiddle.net/wcdjh7a3/. What I'm getting is maybe just the left 20% of the label printed in about .5" of label space; all other label content is cutoff or missing.
Am I missing something here? I just want my html to output to the printer, consuming as much of the 4x2.25 label as possible.
Thanks,
Jonathan Shay
--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
... , size: {width: 4, height: 2.25}, units: 'in', ...
Tres-Thank you for your quick reply. I've made the adjustments you suggested, and am still having an issue. I saw the typos you pointed out in the JSFiddle and have corrected the errors in the HTML.Here's my current configuration:
var printerName = qzPrinters[7];var options = {
orientation: 'landscape',//margins: 0,//scaleContent: false,colorType: 'grayscale',density: 300,units: 'in'
};var config = qz.configs.create(printerName, options);
var html = "<!DOCTYPE html><html><body><div>" +"<table><tr><td><span style='font-size: 8pt;'>Class:</span><span style='font-size: 12pt;'> {classname}</span></td><td></td></tr><tr><td align='center' colspan='2' style='font-size: 26pt;'>{firstname}</td>" +"</tr><tr><td align='center' colspan='2' style='font-size: 18pt;'>{lastname}</td></tr><tr><td rowspan='2' style='font-size: 24pt;'>{allergies}</td><td><table><tr><td style='font-size: 8pt;'>Security Code:</td><td style='font-size: 24pt;'>{securitycode}</td>" +"</tr><tr><td style='font-size: 8pt;'>Bag Count:</td><td style='font-size: 24pt;'>{bagcount}</td></tr></table></td></tr></table>" +
"</div></body></html>";var data = [{type: 'html',format: 'plain',
data: html,options: { pageWidth: 4, pageHeight: 2.25, units: 'in' }
}];qz.print(config, data).catch(function (e) { console.error(e); });
I'm trying to print name tags on a 4" x 2.25" label in landscape mode (so it's wider than it is tall). The above configuration gives me the entire contents of the label, but tucked in what looks to be the bottom left quadrant of the label.Regarding your suggestion for strict CSS pixel sizing, I assume that I would want to make my table 1200px wide (4" wide label @ 300 dpi). However, when I add "style='width: 1200px;' to the table, then the rendered content is only about the left 1/3 of the label, again tucked in the bottom-left quadrant of the label.Could you possible provide an example of printing an empty 4"x2.25" table (maybe with a border) to a Dymo printer?Thanks,Jonathan
> If I include the size parameters as you suggest, then a completely blank label is generated.
> Could you possible provide the necessary parameters to get a tag to print at 300dpi, using the entire width (or a considerable portion thereof) of the label?
Tres-If I include the size parameters as you suggest, then a completely blank label is generated.
Here's my current configuration:
var printerName = qzPrinters[7]; var options = { orientation: 'landscape',
colorType: 'grayscale', density: 300, size: { width: 4, height: 2.25 }, units: 'in' };
var config = qz.configs.create(printerName, options); var html = "<!DOCTYPE html><html><body><div>" +
"<table style='width: 1200px;'><tr><td><span style='font-size: 8pt;'>Class:</span><span style='font-size: 12pt;'> {classname}</span></td><td></td></tr><tr><td align='center' colspan='2' style='font-size: 26pt;'>{firstname}</td>" +
"</tr><tr><td align='center' colspan='2' style='font-size: 18pt;'>{lastname}</td></tr><tr><td rowspan='2' style='font-size: 24pt;'>{allergies}</td><td><table><tr><td style='font-size: 8pt;'>Security Code:</td><td style='font-size: 24pt;'>{securitycode}</td>" + "</tr><tr><td style='font-size: 8pt;'>Bag Count:</td><td style='font-size: 24pt;'>{bagcount}</td></tr></table></td></tr></table>" + "</div></body></html>"; var data = [{ type: 'html', format: 'plain', data: html, options: { pageWidth: 4, pageHeight: 2.25, units: 'in' } }]; qz.print(config, data).catch(function (e) { console.error(e); });
Could you possible provide the necessary parameters to get a tag to print at 300dpi, using the entire width (or a considerable portion thereof) of the label?Thanks,Jonathan ShayPowerChurch Software