How It Works | Samples & Tips | FAQ | Developer Downloads | Support
Sample Projects

 
Contained within the b-PAC download are some sample projects demonstrating it's use with:
  • Microsoft Visual Basic®
  • Microsoft Visual C++®
  • Microsoft VBA (Visual Basic® for Applications - e.g. Microsoft Word®, Microsoft Excel®)
  • Microsoft VBS (Visual Basic® Script)
  • DOS Shell (Command prompt under Windows®)
Nameplate example
The following sample demonstrates the use of b-PAC to create a nameplate application:
  • The user enters the name and company to print nameplate labels.
  • Two template types can be selected - "Simple" and "Patterned Frame".
  • Microsoft Visual Basic® Version 6.0 SP4 was used to create this application.
 


Sample Visual Basic® code for the Nameplate example
 
The following code demonstrates the b-PAC code needed to print the nameplate badge:
Public Sub DoPrint(strPath As String, strExport As String)
   ' Creates the b-PAC object
   Dim ObjDoc As BrssCom.Document .Set ObjDoc = CreateObject("BrssCom.Document")
   ' Opens the template
   If (ObjDoc.Open(strPath) <> False) Then
      ' Searches for text from the field names, and replaces the text
      Dim nIndex As Integer
      nIndex = ObjDoc.GetTextIndex("Company")
      ObjDoc.SetText nIndex, edCompany.Text
      nIndex = ObjDoc.GetTextIndex("Name")
      ObjDoc.SetText nIndex, edName.Text
      ' Prints or exports to a bitmap
      If (strExport = "") Then
         ObjDoc.DoPrint 0, "0" ' Print
      Else
         ObjDoc.Export 2, strExport, 180 ' Export
      End If
   End If
   ' Closes the b-PAC object
   Set ObjDoc = Nothing
End Sub