-
Dear All,
I've got a simple question for all of you. About print to printer. Hopefully, someone can answer my questions.
I have data in my database. I'd like to print them out to my printer directly without using any programs like using Crystal Report.
(Just like print to file (txt file), but this one, I'd like to print to printer).
Could anybody tell me how ???
Thx a lot,
Regards,
Wen Lie
-
No Problem, The Printer acts almost just like a Picturebox, First you have to Start a New Document. Then just use the Printer.CurrentX and Printer.CurrentY Properties to position the Cursor on the Printer and use
Code:
Printer.Print strMyString
to put some text on it, this puts it all on one line though, you need to Split it up to fit it on the page. If you Need to start a new Page use then use to print it.
-
Thx...
Dear Sam,
About your answer,
should I add any Components or References to the codes ???
Thx,
Regards,
Wen Lie
-
Nope, why doesn't it work?
-
Didn't print at all
Well,
Your code doesn't work at my station. Don't you think that I should add a components (ocx or dll) or maybe a reference ???
Or could you give me more code example in printing ???
Thx a lot,
Regards,
Wen Lie
-
OK, My Bad, I don't think you need the Printer.StartDoc
try this
Code:
Printer.Print "Hello"
Printer.EndDoc
My Printer's Broken So I can't test it.
-
It's also a good idea to set the coordinates of where you want to print. Otherwise, it will print to the Top-Left corner.
Code:
Printer.CurrentX = 1440
Printer.CurrentY = 1440
Printer.Print "Hello"
Printer.EndDoc
This will create a 1"x1" margin (1440 Twips per Inch). (If you set the ScaleMode to Inches, then you can change 1440 to 1)