Printer.Width = 5760 ‘4 inches in twips
Printer.CurrentX = 1440 ‘1 inch (column position)
Printer.CurrentY = 2160 ‘2 inches (row position)
Printer.Print “0123456789”
Printer.EndDoc
End Sub
Private Sub Form_Load()
Dim X As Printer
Dim I As Integer ‘Used for the font list
‘ search for printer queue name / driver name
For Each X In Printers
If X.DeviceName = “Datamax I-4206” Then ‘printer found
‘ Set printer as system default.
Set Printer = X
For I = 0 To Printer.FontCount - 1 ‘ Determine number of fonts.
cmboFonts.AddItem Printer.Fonts(I) ‘ Put each font into list box.
Next I
Exit For
End If
Next
End Sub
‘Exit the program and shut down the serial port
‘by clicking Exit button with the mouse
Private Sub cmdExit_Click()
End
End Sub
When the program is run, the combo box should be populated with the available fonts
as shown below.
VB Application to Send Raw Data via Printer Driver
This is a sample Visual Basic program that checks for any printer driver attached to
“LPT1”. If one is installed, then a DPL file can be printed via the print driver. DPL is
created by the application and sent to LPT1.
Note: The driver does not need to be a Datamax-O’Neil DPL print driver.
290
DPLCommand Reference