CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Posts
    19

    Printing Crystal report in dos Mode

    hello
    i want to print crystal report generated from VB in Dos Mode
    please can anyone help me
    Thanx for prompt response

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332
    Hi. If you want to print to a DOS printer, then you need to send all the data, line by line, to the printer. If you need to use the different fonts that the printer has built in, then you send them also, by using escape codes. Generally, escape codes will be a Chr(27), followed by the codes that you want to use. For instance, to get italic on a typical printer using Epson LQ-850 emulation, you would send this:
    Code:
    Print #1, Chr(27); Chr(52); 'italic on
    Now to turn Italic off, do this:
    Code:
    Print #1, Chr(27); Chr(53); 'italic off
    To print an entire page of data, you will need to do all the formatting yourself, which is not that big a deal once you get the hang of it.

    Here are some codes you may want to use:
    Code:
    Print #1, Chr(27); Chr(64); 'reset
    Print #1, Chr(27); Chr(67); Chr(32); 'page length in lines
    Print #1, Chr(27); Chr(107); Chr(3); 'font
    Print #1, Chr(27); Chr(77); 'pitch 12
    Print #1, Chr(27); Chr(119); Chr(1); Chr(14); 'double high & wide
    Print #1, Chr(27); Chr(120); Chr(1); 'letter quality
    Print #1, Chr(27); Chr(65); Chr(5); '5/60 inch line feed
    Print #1, Chr(27); Chr(52); 'italic
    Print #1, Chr(27); Chr(53); 'italic off
    Print #1, Chr(27); Chr(119); Chr(0); Chr(20); 'double high & wide off
    Print #1, Chr(27); Chr(48); '1/8 inch line feed
    Have fun!!
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

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

Featured