You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to use some DK-1203 labels with my QL-570 and unfortunately, there wasn't a template predefined for them.
No matter how I defined a custom size within glabels 3.4.1 (the version packaged for Ubuntu 20.04) it just wouldn't work. (And I tried over and over again getting a red flashing light on the QL-570).
Within the cupswrapper printer driver source codes PPD file from brother's website there's a few sizes given.
The file name is brother_ql570_printer_en.ppd
Why not write a script to do this in lua, and copying just the relevant lines:
Here's my crap script:
function printt(t) for i,j in pairs(t) do print(i,j) end end
pd = {}
ia = {}
function processline(l)
local index
if string.find(l,"*PaperDimension") then tab = pd end
if string.find(l,"*ImageableArea") then tab = ia end
m=string.gmatch(l,"(%d+)")
x=m()
y=m()
index=x.."x"..y
mstart,mend,mstr = string.find(l,":.*\"(.*)\"")
tab[index]={}
for x in string.gmatch(mstr,"([%d%.]+)") do
table.insert(tab[index],x)
end
end
dk={}
dk["17x54"]="DK-1204 DK-11204"
dk["17x87"]="DK-1203 DK-11203"
dk["23x23"]="DK-1221 DK-11221"
dk["29x90"]="DK-1201 DK-11201"
dk["38x90"]="DK-1208 DK-11208"
dk["39x48"]="DK-1220 DK-11220"
dk["52x29"]="DK-1226 DK-11226"
dk["62x29"]="DK-1209 DK-11209"
dk["62x100"]="DK-1202 DK-11202"
dksort={} dktosize = {} for i,j in pairs(dk) do table.insert(dksort,j) dktosize[j]=i end table.sort(dksort) printt(dksort) for i,j in pairs(dksort) do print(j,dktosize[j]) end
function lines(str)
local result = {}
local line
for line in str:gmatch '[^\n]+' do
table.insert(result, line)
end
return result
end
ppdstr =
[[*ImageableArea 17x54/17mm x 54mm(2/3" x 2-1/8"): "4.32 8.4 43.92 144.24"
*ImageableArea 17x87/17mm x 87mm(2/3" x 3-7/16"): "4.32 8.4 43.92 237.84"
*ImageableArea 23x23/23mm x 23mm(10/11" x 10/11"): "4.32 8.4 60.96 56.88"
*ImageableArea 29x90/29mm x 90mm(1-1/7" x 3-1/2"): "4.32 8.4 77.76 246.24"
*ImageableArea 38x90/38mm x 90mm(1-1/2" x 3-1/2"): "4.32 8.4 103.44 246.24"
*ImageableArea 39x48/39mm x 48mm(1-1/2" x 1-8/9"): "4.32 8.4 106.32 127.20"
*ImageableArea 52x29/52mm x 29mm(2" x 1-1/7"): "4.32 8.4 143.04 73.44"
*ImageableArea 62x29/62mm x 29mm(2-3/7" x 1-1/7"): "4.32 8.4 171.36 73.44"
*ImageableArea 62x100/62mm x 100mm(2-3/7" x 4"): "4.32 8.4 171.36 274.56"
*PaperDimension 17x54/17mm x 54mm(2/3" x 2-1/8"): "48.24 152.64"
*PaperDimension 17x87/17mm x 87mm(2/3" x 3-7/16"): "48.24 246.24"
*PaperDimension 23x23/23mm x 23mm(10/11" x 10/11"): "65.28 65.28"
*PaperDimension 29x90/29mm x 90mm(1-1/7" x 3-1/2"): "82.08 254.64"
*PaperDimension 38x90/38mm x 90mm(1-1/2" x 3-1/2"): "107.76 254.64"
*PaperDimension 39x48/39mm x 48mm(1-1/2" x 1-8/9"): "110.64 135.60"
*PaperDimension 52x29/52mm x 29mm(2" x 1-1/7"): "147.36 81.84"
*PaperDimension 62x29/62mm x 29mm(2-3/7" x 1-1/7"): "175.68 81.84"
*PaperDimension 62x100/62mm x 100mm(2-3/7" x 4"): "175.68 282.96"]]
ppdlines=lines(ppdstr)
for linekey,linevalue in pairs(ppdlines) do processline(linevalue) end
function opentag(tag) io.write("<"..tag.." ") end
function endtag() io.write(">") print() end
function endtagclose() io.write("/>") print() end
function closetag(tag) print("</"..tag..">") end
function attr(at,val) io.write(at.."=\""..val.."\" ") end
function tab(t) io.write(string.rep(" ",t)) end
function maketemplate()
opentag("Template")attr("brand","Brother")attr("part","Generated "..dk[index])attr("size","Other")attr("width",pd[index][1].."pt")attr("height",pd[index][2].."pt")attr("description",index)endtag()
tab(4)opentag("Label-rectangle")attr("id","0")attr("width",pd[index][1].."pt")attr("height",pd[index][2].."pt")attr("round","4pt")attr("x_waste","0")attr("y_waste","0")endtag()
tab(8)opentag("Markup-rect")attr("x1",ia[index][1].."pt")attr("y1",ia[index][2].."pt")attr("w",ia[index][3].."pt")attr("h",ia[index][4].."pt")endtagclose()
tab(8)opentag("Layout")attr("nx","1")attr("ny","1")attr("x0","0")attr("y0","0")attr("dx","0")attr("dy","0")endtagclose()
tab(4)closetag("Label-rectangle")
closetag("Template")
end
print([[<?xml version="1.0"?>
<Glabels-templates xmlns="http://glabels.org/xmlns/3.0/">
]])
for key,value in pairs(dksort) do
index=dktosize[value]
maketemplate()
end
print()
print("</Glabels-templates>")
and the output (putting this inside of a file in $HOME/.config/libglabels/templates/brother_generated.template)
Hi,
I wanted to use some DK-1203 labels with my QL-570 and unfortunately, there wasn't a template predefined for them.
No matter how I defined a custom size within glabels 3.4.1 (the version packaged for Ubuntu 20.04) it just wouldn't work. (And I tried over and over again getting a red flashing light on the QL-570).
Within the cupswrapper printer driver source codes PPD file from brother's website there's a few sizes given.
The file name is brother_ql570_printer_en.ppd
https://support.brother.com/g/b/downloadlist.aspx?c=eu_ot&lang=en&prod=lpql570euk&os=130#SelectLanguageType-593_0_1
Why not write a script to do this in lua, and copying just the relevant lines:
Here's my crap script:
and the output (putting this inside of a file in $HOME/.config/libglabels/templates/brother_generated.template)
The text was updated successfully, but these errors were encountered: