Results 1 to 7 of 7

Thread: Print to printer

  1. #1

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Unhappy

    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
    Regards,
    [-w-]

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    No Problem, The Printer acts almost just like a Picturebox, First you have to Start a New Document.
    Code:
    Printer.StartDoc
    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
    Code:
    Printer.NewPage
    then use
    Code:
    Printer.EndDoc
    to print it.

  3. #3

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Wink Thx...

    Dear Sam,

    About your answer,
    should I add any Components or References to the codes ???

    Thx,
    Regards,
    Wen Lie
    Regards,
    [-w-]

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Nope, why doesn't it work?

  5. #5

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Question 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
    Regards,
    [-w-]

  6. #6
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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.

  7. #7
    Guest
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width