Brother label printer code..

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Brother label printer code..

Post by Fangbeast »

Since my Dymo died, I aquired a brother label printer but haven't done much with it and wanted to add it to my address book.

Is anyone familiar with vbscript and com? (Brother has the sdk and I downloaded it but not familiar with either.

Code: Select all

'	b-PAC 3.0 Component Sample (Instant Name Plate)

This is an example of creating a nameplate from vbs and I assume I'd have to load their dll first: "Interop.bpac.DLL"

'	(C)Copyright Brother Industries, Ltd. 2009
'
'<SCRIPT LANGUAGE="VBScript">
	' Data Folder
	Const sDataFolder = "C:\Program Files\Brother bPAC3 SDK\Templates\"
	DoPrint(sDataFolder & "NamePlate1.lbx")

	'*******************************************************************
	'	Print Module
	'*******************************************************************
	Sub DoPrint(strFilePath)
		Set ObjDoc = CreateObject("bpac.Document")
		bRet = ObjDoc.Open(strFilePath)
		If (bRet <> False) Then
			ObjDoc.GetObject("objCompany").Text = "Brother Industries, Ltd."
			ObjDoc.GetObject("objName").Text = "John Smith"
			' ObjDoc.SetMediaByName ObjDoc.Printer.GetMediaName(), True
			ObjDoc.StartPrint "", 0
			ObjDoc.PrintOut 1, 0
			ObjDoc.EndPrint
			ObjDoc.Close
		End If
		Set ObjDoc = Nothing
	End Sub
Amateur Radio, D-STAR/VK3HAF
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Brother label printer code..

Post by JHPJHP »

Hi Fangbeast,

Install the SDK, which should (system-wide) register the COM object; should not need to do anything with the DLL.

If the printer (driver) is installed, the test script should run as is. If you get an error message, post it here.

NOTE: Confirm the path after install.
- Program Files / Program Files (x86)

Code: Select all

Const sDataFolder = "C:\Program Files\Brother bPAC3 SDK\Templates\"
DoPrint(sDataFolder & "NamePlate1.lbx")
http://www.brother.com/product/dev/faq/ ... .htm#faq01
b-PAC Ver. 3.0/3.1 supports Windows® 7.
*: b-PAC Ver.3.0/3.1(32bit Version) is available for 32bit applications on 32bit OS.
*: b-PAC Ver.3.0/3.1(32bit Version) is available for 32bit applications on 64bit OS.
*: b-PAC Ver.3.0/3.1(32bit Version) is not available for 64bit application on 64bit OS.
*: b-PAC Ver.3.1(64bit Version) is available for 64bit application on 64bit OS.
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: Brother label printer code..

Post by Marc56us »

Hi Fangbeast,

I don't know how this printer works, but if the driver is installed (Windows), it should be able to be used as a normal printer.
For information, I use my Dymo 450 as a normal printer. The driver takes care of the size of the paper and causes the advance of each label by sending a simple form feed code.
No need SDK, PureBasic printer lib do the job.

Code: Select all

If PrintRequester()
     ID_Font = LoadFont(0, "Arial", 30) 
     If StartPrinting("Test")   
          If StartDrawing(PrinterOutput())
               DrawingMode(#PB_2DDrawing_Transparent)
               DrawingFont(ID_Font)
               DrawText(10, 10, "Hello World", RGB(0, 0, 0))
               DrawingMode(#PB_2DDrawing_Outlined)
               Circle(100,100,100 , RGB(255,0,0))     
               StopDrawing()
          EndIf
          StopPrinting()
     EndIf
EndIf
StopPrinting() print text and graphic and positions itself at the beginning of the next label.

:wink:
User avatar
Fangbeast
PureBasic Protozoa
PureBasic Protozoa
Posts: 4749
Joined: Fri Apr 25, 2003 3:08 pm
Location: Not Sydney!!! (Bad water, no goats)

Re: Brother label printer code..

Post by Fangbeast »

Well, looks like I am about to revisit this project as I am about to rewrite my addressbook and no longer have the dymo printer (locked up and died).

Amazing what 8 months of broken ribs recovery (and other health issues) will do to you.

Have to really learn modules as well as the code is getting complex for my old brain and modules will help with isolation.
Amateur Radio, D-STAR/VK3HAF
Post Reply