[ic] Dymo and Brother Label Printer Examples - Windows

Paul Jordan paul at gishnetwork.com
Mon Apr 3 12:22:37 EDT 2006



Hello List, for a few years we have been using a Dymo 330/400 to print
various labels from within IC. Recently I had a client using a Brother, so I
took some SDK examples and produced the sample below. Both these example can
basically be dropped right in Admin (Similar to Jason's example) and work on
Windows. 

Dymo http://global.dymo.com/enUS/Categories/LabelWriter_Printers.html

Jason Kohles How to:
http://www.icdevgroup.org/pipermail/interchange-users/2001-February/004784.h
tml
Note: You might want to change the regexes to be xhtml compliant, or it will
miss some <br />'s.


Brother QL-500 and similar:
http://www.brother-usa.com/ptouch/

1. Print button to make Label:

      <A style="color:red;" HREF="#" onClick="Prints();">Label</a>

2. Set some scratch vars with shipping information:

    [tmp bro_name][loop-param fname] [loop-param lname][/tmp]

    [tmp bro_add][loop-param address1][/tmp]

    [tmp bro_add2][loop-param address2][/tmp]

    [tmp bro_csz][loop-param city], [loop-param state] [loop-param
zip][/tmp]

    [tmp bro_co][data table=country col=name key='[loop-param country]'
filter='uc'][/tmp]



3. VBScript somewhere on the Page:

<SCRIPT LANGUAGE="VBScript">

Sub Prints()
        Set ObjDoc = CreateObject("BrssCom.Document")
        bRet = ObjDoc.Open("__BROTHER_LABEL__")
        If (bRet <> False) Then
            ObjDoc.SetText 0, "[scratch bro_name]"
            ObjDoc.SetText 1, "[scratch bro_add]"
    [if scratch bro_add2]
            ObjDoc.SetText 2, "[scratch bro_add2]"
            ObjDoc.SetText 3, "[scratch bro_csz]"
            ObjDoc.SetText 4, "[scratch bro_co]"
    [else]
            ObjDoc.SetText 2, "[scratch bro_csz]"
            ObjDoc.SetText 3, "[scratch bro_co]"
    [/else][/if]
            ObjDoc.DoPrint 0, "0"
        End If
        Set ObjDoc = Nothing
End Sub
</script>


4. In Variables.txt add something like:

   BROTHER_LABEL	C:\labels\imb.lbl

Note: Put website into Trusted Zones as per Jason Kohles example.


5. Just open up the Ptouch Label editor, make a label. From what I have
figured out is that the "SetText N" in the above Vbscript writes to the
label from the bottom up. So, make you label pretty, then be sure the bottom
most element is for example a large text box comprised of at least 5 text
lines. Leave them blank, but hit "enter" to make sure there are 5 text lines
in the text box. Save the label to the path to your label template
"C:\foo\bar\baz.lbl"

6. You have to install another application (besides the print driver of
course) called B-Pac Client. From what I can tell it does not continuously
run, so it does not bog down your PC.
http://www.brother-usa.com/ptouch/software/bpac/bpac-home.asp

With a little extra code you can let users use whichever printer they want
based on some field in your administrators table.

Maybe someone can improve upon these and repost in the future. Also,
Endicia.com has an API that should allow printing to a dymo, postage and all
- which is nice as the labels are not big, for those of us who have small
packages.... Doh! that didn't sound good...


 Paul Jordan



More information about the interchange-users mailing list