Solved

Printing in a matrix printer

Posted on 1998-07-24
3
344 Views
Last Modified: 2013-12-03
I am doing a report with de printer object in a matrix printer. This report is bigger than one page. I use fontsize 10 and font type courier, the first page is printed well. In the second page start the problem, it appears characters bigger than the space destinated to them. Then, the print has like a half of the line printed and continue witth the next half line that must be a complet line, and it follows until the end of the page.
I change the fontsize and font each time there is a new page.What is happening, and how I can solve my problem ?
Thank you
pd The printer is an Epson, and it has only few fonts like courier, orator, pica, etc.
Pepe
0
Comment
Question by:al361345
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 200 total points
ID: 1466611
al361345, here is the answer:

Fix Printer Object Font/Paging Quirk
An ‘undocumented feature’ of the VB Printer Object requires that each new page be initialized before the font can be changed.
You would think that the following code would change the current font of the default printer in VB, but you’d be wrong:

    With Printer.Font
    .Name = "Arial"
    .Size = 11
    End With

    sText = "What a waste it is to lose one’s mind."
    Printer.Print sText


This code works as expected:

    ' Start new page
    Printer.Print
    With Printer
    ' Set margins as desired
    .ScaleMode = vbTwips
    .CurrentX = 720
    .CurrentY = 720
    ' Now you can set the font
    With .Font
    .Name = "Arial"
    .Size = 11
    End With

    End With

    sText = "If we don’t succeed, we run the risk of failure."
    Printer.Print sText
    Printer.EndDoc

You MUST initialize each new page using similar code.

Best regards.
0
 

Author Comment

by:al361345
ID: 1466612
Thanks, kamall. I have now another problem. I already wrote my question on the discussion group.
Thank you again.
Pepe
0
 
LVL 7

Expert Comment

by:kamall
ID: 1466613
You are welcome Pepe.
I will check you new question and see if I can help.
Best regards.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question