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
|