Solved

Printer Object / Dot Matrix Priners

Posted on 2000-03-07
2
164 Views
Last Modified: 2010-05-02
I am having trouble printing labels (8 down x 4 across) with an OKI dot matrix/A4 printer. I am trying to use the printer object and set the 'PaperSize' property to 256(User defined) and then setting what I think are the right measurements of the page of labels in the 'Height' and 'Width' properties of the printer object.
The 'ScaleMode' property is set to twips. I have no problem getting the height to be high enough but not the width. The widest it will go is the same width as the A4 page.

Can anyone shed light on the situation for me as to what I'm doing wrong or not doing at all?

Thanks in advance.
0
Comment
Question by:mickdoherty
2 Comments
 
LVL 2

Expert Comment

by:damienm
ID: 2592374
If it is an A4 Printer why do you want to print any wider than A4?
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 150 total points
ID: 2593404
The maximum width in this case is controlled by your Windows printer driver.  If your driver is coded so that the maximum width is "A4" paper width, then you won't be able to print beyond that using the Printer object.

Assuming that the printer will print wider than "A4", you have two possible answers.  One, find a printer driver that allows you to use the full width capability of the printer.

If you can't find such a driver, you can always send what you need to print directly to the printer.  You will lose a lot of versatility, but if you have to, you have to.  

To do this, you will need to open your LPT: port for binary access, e.g.

 PrintFile = FreeFile
 Open "LPT2" For Binary As #(PrintFile)

Spacing, line feeds, bold, italic, underline, etc. will need to be controlled explicitly.  For example, to switch your printer into and out of 'compressed' print mode, the commands might be:

 CompOn = Chr(15)
 CompOff = Chr(18)

In place of Printer.Print, you would use something like this:

 Global Col as Integer
 Global Row as Integer

 Sub PrintDirect(ByVal S$, Optional ByVal DoCR)

    Put #(PrintFile), , S
    Col=Col + Len(S)
    If DoCR = True Then
        Put #(PrintFile), , vbCrLf
        Col = 1
        Row = Row + 1
    End If

 End Sub

 Sub PositionPrinter(ByVal GotoCol, ByVal GotoRow)

    If GotoCol>Col Then
        Put #(PrintFile), , _
           Space(GotoCol-Col)
        Col = GotoCol
    End If
    Do While Row<GotoRow
        Put #(PrintFile), , _
          Chr(10) ' Line Feed
        Row = Row + 1
    Loop

End Sub

Sub BoldPrint(On)
    If On Then
        Put #(PrintFile), , BoldOn
    Else
        Put #(PrintFile), , BoldOff
    End If
End Sub
Now, printing would be something like this:

  Col=1
  Row=1

  PrintDirect "My Name"  ' Col now = 8

  PositionPrinter 30,3   ' Col=30, Row=3
  BoldPrint True
  PrintDirect "Your Name", True
        ' Col = 1, Row = 4
  BoldPrint False
..
..
..

Hope this helps
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

816 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now