Most of label printers can act as regular printer which means that you can print as you do on regular ones.
For each model you can see product documentation on vendors web support and see how you can send complex data which should generated before printing started (e.g. BARCODE, QR Code).
Some of them already have their own SDK’s for dev. integration.
Making PDF and then doing post process by printing PDF is a bit complex for end user end and make a complete process more complex then just like you were doing a printing on e.g. Windows OS by Ctrl+P
Happy new year and marry x-mas to you and your family!
each manufacturer has is own programming codes for his label printers
I made one for the epson TML series, then it’s only sending serial codes to an usb/serial converter.
it’s easy to make, and faster than try to use the manufacturer driver that complexify all the printing mechanism.
but you have to do it for any brand. you need to use
I’ve coded my own interface to a Zebra label printer in the past (firing raw data to the printer) but I put together a Dymo demo here to try and help Dean.
The Dymo stuff is super simple, you can design your labels using their software, save it to file then reference that file with custom text/data to be inserted where needed and it just works.
[quote=366993:@JulianS]I’ve coded my own interface to a Zebra label printer in the past (firing raw data to the printer) but I put together a Dymo demo here to try and help Dean.
The Dymo stuff is super simple, you can design your labels using their software, save it to file then reference that file with custom text/data to be inserted where needed and it just works.
They support everything you posted about above.[/quote]
how to called the text file with the data from the database?
You just name your “Fields” in the dymo label designer and reference them from the code, so in the example above I have a barcode field called “BARCODE”, but you could do the same for QR codes or text fields just as easily.
Another way to do is to simply get a Graphics context from OpenPrinterDialog and then draw the label there. I adjust the the textSize when the number of lines on the label increases.
I print to a brother QL-550 label printer, using the code below.
I also save the printer setup and restore it before showing the print dialog:
[code]Public Sub imFilePrintLabel(UseAddressesFromLinkedDataBox As Boolean = False)
// No data => no labels
If WindowMain.imDataBox1.imGetActiveListbox.ListCount <= 0 Then Return
#If TargetWindows Or TargetCocoa Then
// Retrieve IDs of selected addresses
Dim arAdID() As String
arAdID = imUI.arSelectedAddressIDs
If arAdID <> Nil Then
// Get number of found IDs
Dim numAdr As Integer = UBound(arAdID)
// Define Variables and Default Values
Dim adID, thisLabel, sql As String
Dim i,strH, labelH As Integer
Dim g As Graphics
Dim rs As RecordSet
Dim numLines As Integer = 1
Dim tSize As Integer = 42
Dim leftIndent As Integer = 40
If imUI.LabelPrinterSetup = Nil Then
imUI.LabelPrinterSetup = New printerSetup
// If LabelPrinter settings have been set before
// Load them into pagessetup
If SUPRT.LabelPrinterSetupString <> "" Then
imUI.LabelPrinterSetup.SetupString=SUPRT.LabelPrinterSetupString
Else
If Not WindowMain.imAction.imFilePrintLabelSetup Then
MsgBox arbStrings.Print_Label_Setup_failed
imUI.LabelPrinterSetup=Nil
Return
End If
End If
End If
LabelPrinterSetup.MaxHorizontalResolution = 300
LabelPrinterSetup.MaxVerticalResolution = 300
g=OpenPrinterDialog(LabelPrinterSetup)
If g <> Nil Then
g.TextSize = tSize
For i = 0 To numAdr
adID = arAdID(i)
If Trim(adID) <> "" Then
// Get Label for selected address
sql = "SELECT Label FROM " + imDB.prefix + "addresses WHERE id = " + adID
rs = imDatabase.SQLSelect(sql)
If imDatabase.Error Then
logError("[" + CurrentMethodName + "] " +"PrintLabel : Error retrieving Label from database : " + imDatabase.ErrorMessage + " : " + sql)
// skip over the remaining statements in the For loop
// and resume with a new iteration of the loop.
Continue
End If
If rs <> Nil And Not rs.EOF Then
thisLabel = rs.Field("Label").StringValue
thisLabel = ReplaceLineEndings(thisLabel, EndOfLine)
If Trim(thisLabel) <> "" Then
// Assign Label to hidden editfield
WindowLabel.TextArea1.text=Trim(thisLabel)
numLines = WindowLabel.TextArea1.LineNumAtCharPos(WindowLabel.TextArea1.Text.Len)+1
If numLines > 0 Then
// Adjust textSize for higher number of
// print lines on the label
Select Case True
Case numLines <= 5
// Do not change default tSize of 42
Case numLines = 6
' tSize = tSize-4
Case numLines = 7
tSize = tSize-8
Case numLines = 8
tSize = tSize-10
Case Else
tSize = 28
End Select
g.TextSize = tSize
strH = g.StringHeight("Test",g.Width-20)
labelH = (numLines * strH)
Dim x,y As Integer
// Coordinates, where to print label
x = leftIndent
y = (g.Height-labelH+(2*strh))/2
g.drawstring(thisLabel, x, y)
If i < numAdr Then
g.NextPage
End If
End If
End If // trim(thisLabel) <> ""
rs.MoveNext
End If // rs <> Nil AND NOT rs.EOF
End If // trim(adID) <> ""
Next
End If
End If // arAdID <> Nil
[quote=367108:@Oliver Osswald]Another way to do is to simply get a Graphics context from OpenPrinterDialog and then draw the label there. I adjust the the textSize when the number of lines on the label increases.
I print to a brother QL-550 label printer, using the code below.
I also save the printer setup and restore it before showing the print dialog:
[/quote]
I’m trying to print to a QL-800, but when I call OpenPrinterDialog, the dialog says the label with wasn’t found. Is there a secret sauce to the printersetupstring that I can use to set the label width?