Printing Barcodes to a Zebra Printer
I am using an Advanced PDF/HTML Template and can print what I want on a barcode label. What I don’t know how to do is get it to print properly on a Zebra GC420d printer. I tried putting a <pbr /> tag after before the </#list> tag but it give me errors and I cannot save it. See attached PDF
Set the size of the document to be one label then use an if statement to make sure you print one label per page:
<#if result?has_next><pbr/></#if> – substitute result with whatever you have called your list.
This goes outside of your table (assuming you built the label as a table) but inside your list.
I am assuming the <#if result?has_next><pbr/></#if> needs to go inside the list tags. When I try and put the statement before the </#list> I get a syntax error. Any ideas?
<body padding="0.5in 0.5in 0.5in 0.5in" size="Letter"> <table style="width: 1.5in; height: 4in; font-size: 9pt; page-break-inside: avoid;"><#list results as result><#if result_index == 0> <thead> </thead> </#if> <tr> <td>${result.displayname}</td> </tr> <tr> <td><barcode bar-width="0.5" codetype="code128" showtext="true" value="${result.itemid}"></barcode></td> <td> </td> </tr> <tr> <td>Rec:${result.tranid} Bin:${result.binnumber}</td> </tr> <tr> <td>Exp:${result.expirationdate} Serial/Lot:${result.serialnumber}</td> </tr> </#list></table> </body> </pdf>
I found this reference https://freemarker.apache.org/docs/ref.html and am wondering if I can use all of the specialized tags listed. Also, what is the language? Is it just XML, Javascript?
Yes that will need to go inside the list. I would recommend structuring so that your <#list> sits outside of your <table> which tells it to make a table for each result rather than trying to split one table over many pages.
Also, with your example code, in the body section where it has size=”letter” you will want to change “letter” to dimensions that match the size of the label you are trying to print.
This is made up of HTML and Freemarker.