1. Tracy Lamb
  2. PowerBuilder
  3. Thursday, 4 October 2018 15:28 PM UTC

I want to use Brother label printers to print labels.  How do I declare variables of the right type so I can use their interface (dll) file?  Here's their interface:

b-PAC 3.2 API Reference

This describes the classes, structures, shared objects, and interfaces.

bpac::IDocument Document interface
bpac::IObject Object interface
bpac::IObjects Object collection interface
bpac::IPrinter Printer interface
Other functions  


For instance, I need to open a document object then populate some of the text objects on the document with data. 

Here's a C# example (I think)

// Document sample

bpac.IDocument doc = new bpac.Document;
doc.Open("File Path");
// Printer interface acquisition
bpac.IPrinter printer = doc.Printer; ...
// Object collection acquisition
bpac.IObjects objs = doc.Objects; ...
// Object acquisition
bpac.IObject obj = doc.GetObject("Object1");
obj.Text = "Test";

I understand that I can declare global external functions, but how does this help me declare the different interface objects?

TIA, Tracy

Accepted Answer
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 4 October 2018 16:44 PM UTC
  2. PowerBuilder
  3. # Permalink

It is a COM control so you would use PowerBuilder's OLE support. Something like this:


OLEObject doc

Integer li_rc


doc = Create OLEObject

li_rc = doc.ConnectToNewObject("bpac.Document")



Destroy doc


There are no comments made yet.
Tracy Lamb Accepted Answer Pending Moderation
  1. Wednesday, 10 October 2018 14:29 PM UTC
  2. PowerBuilder
  3. # 1

Thanks!  That's the right answer, works great, except when it doesn't work... LOL!  Having trouble actually getting a printout after I open a template and get the right printer... chasing that one down now.

Thanks again!


There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 4 October 2018 17:13 PM UTC
  2. PowerBuilder
  3. # 2

Hi Tracy;

  If the printer does not have a native MS-Wndows driver (I would check on that first), then you would have two other options:

1) Open the COM port via a FileOpen() PB command and then use the low-level Print() commands to talk directly to the printer.

2) Declare the brother printer DLL (you mention is in your post) methods as PB "External" declarations and then call the printer driver's methods as per their documentation.


Regards ... Chris

There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.