I need to print a magnetic band in a card printer, i found a code in VB that use a printer object, and a need do the same in VFP, with this printer object i cant directly send command to printer.
This is the code in VB.
CommonDialog1.ShowPrinter 'Use the common dialog so that changes
'may be made to the driver
Printer.ScaleMode = 6 'Vb millimeters
Printer.CurrentX = 0 'Left, be aware of driver's orientation
Printer.CurrentY = 0 'Top, be aware of driver's orientation
Printer.FontName = "System"
'Tilde, track number method is used to send magnetic encoding data
'These two characters inform the driver to create encoding commands
'The next two lines will encode but do not print.
Printer.Print "~1" & txtAcct 'track 1, Alphanumeric allowed
Printer.Print "~2" & txtAcct 'track 2, numeric only
'Track three is not shown in this example
Printer.PaintPicture Picture1.Picture, 40, 12, 35, 35
'Use any true type font to print on the card
Printer.Font.Name = "Arial"
Printer.FontBold = False
Printer.FontSize = 16
Printer.CurrentX = 12
Printer.CurrentY = 12
Printer.Print txtFname
Printer.CurrentX = 12
Printer.CurrentY = 24
Printer.Print txtLname
Printer.CurrentX = 12
Printer.CurrentY = 36
Printer.Print txtAcct
'No barcode sent, see 010109-000004 click assist example if needed
Printer.EndDoc 'This line sends the job to the driver
There are two ways of doing this in VFP. First, the @ / SAY command will let you print at precise positions on the page -- the positions are measured in characters, though, rather than pixels.
Also, ??? will let you send any command to the printer, bypassing the printer driver. If you know the printer's command language, you can use this to finely control the printer.
If you just want to brint bar codes, the easiest way is to acquire a barcode font. I have done that in the past, and it is simple.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.