FIX: Printer.Print Statements Unable to Print w/ Postscript

Last reviewed: October 30, 1997
Article ID: Q113593
1.00 2.00 WINDOWS kbpring kbprg kbbuglist

The information in this article applies to:

- Microsoft Visual Basic programming system for Windows,

  versions 1.0 and 2.0

SYMPTOMS

Nothing prints on the paper when you try to print a string to the printer using the printer.print statement. Nothing prints when code processing reaches the printer.enddoc statement or the end of the program.

CAUSE

The following two Postscript printer drivers were tested and found to have a problem with Microsoft Visual Basic versions 1.0 and 2.0 for Windows. The drivers with the problem are:

  • PSCRIPT.DRV 318112 bytes dated 10-01-92
  • PSCRIPT.DRV 313520 bytes dated 3-02-92

The problem is that nothing prints on the paper. The Printer.Print statement(s) may be ignored entirely when you are using either of the two drivers listed above.

WORKAROUND

Add two statements prior to the Printer.Print statement(s) to correct the problem. You need to set the Printer.CurrentX and Printer.CurrentY properties to positive values. Then add the Printer.Print statement and you should see the desired string printed on the printer's page.

STATUS

Microsoft has confirmed this to be a bug in the products listed at the beginning of this article. This problem did not occur in Visual Basic version 3.0.

MORE INFORMATION

Note that you will need a PSCRIPT.DRV 318112 bytes 10-01-92 or PSCRIPT.DRV 313520 bytes dated 3-02-92 postscript printer driver to reproduce the problem outlined below.

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 is created by default.

  2. Add a Command button (Command1) to Form1.

  3. Add the following code to the Command1 click event procedure:

       Sub Command1_Click ()
          Printer.Print "This is a test of the Postscript printer driver"
          printer.enddoc
       End Sub
    
    

  4. Run the program and click the Command1 button. You should see a blank piece of paper printed out if you have one of the specified drivers.

Additional Steps to Work Around the Problem

  1. To work around the problem, add two lines of code to the Command1 click event procedure:

       Sub Command1_Click ()
          printer.CurrentX = 1
          printer.CurrentY = 1
          printer.Print "This is a test of the Postscript printer driver"
          printer.EndDoc
       End Sub
    
    

  2. Run the program and click the Command1 button. Now you should see the line of text: 'This is a test of the Postscript printer driver' printed on the paper.


Additional reference words: buglist1.00 buglist2.00 fixlist3.00 1.00 2.00
buglist1.00 buglist2.00 fixlist3.00
KBCategory: kbpring kbprg kbbuglist
KBSubcategory: APrgPrint
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.