troubleshooting Question

How do you set Paper Size for Dot Matrix Printer?

Avatar of Kevin
KevinFlag for United States of America asked on
Printers and ScannersVisual Basic.NET
4 Comments1 Solution11414 ViewsLast Modified:
Good Evening,

I have developed a Cheque printing application in VB.NET which will be using an “OKI Microline 390 Turbo” dot matrix printer. I’m using the “Generic / Text Only” driver and have created a custom paper size of 8.5 inches by 7 inches. The paper being used is continuous carbon paper being fed in from the rear of the printer via the tractors.

I have been able to print to this printer successfully from my application, using Epson escape sequences to communicate with the printer.

'Printer - Epson Emulation Escapes
    Public Const eClear As String = Chr(27) + "@" 'Initialize printer
    Public Const eProSpaceON As String = Chr(27) + "!" + Chr(1) 'Start Porportional Spacing 
    Public Const eProSpaceOFF As String = Chr(27) + "!" + Chr(0) 'Stop Porportional Spacing
    Public Const eTypeface As String = Chr(27) + "k" + Chr(122) 'Typeface 0 Roman, 1 Swiss, 2 Courier, 3 Prestige, 7 Orator, 122 Swiss Bold, 124 Gothic
    Public Const ePitch10 As String = Chr(27) + "P" '10 CPI Pitch
    Public Const ePitch12 As String = Chr(27) + "M" '12 CPI Pitch
    Public Const ePitch15 As String = Chr(27) + "g" '15 CPI Pitch
    Public Const eCentre As String = Chr(27) + Chr(97) + "1" 'Center Justification
    Public Const eLeft As String = Chr(27) + Chr(97) + "0" 'Left Justification
    Public Const eRight As String = Chr(27) + Chr(97) + "2" 'Right Justification
    Public Const eHTAB As String = Chr(9) 'Horizontal Tab
    Public Const eBRVPos As String = Chr(27) + "(v" + Chr(2) + Chr(0) + Chr(81) + Chr(2) 'Relative Vertical Postion: BODY START POSITION X inches
    Public Const eFormFeed As String = Chr(12)

    'Body Specific Cheque Alignment
    Public Const eBChqNum As String = Chr(27) + "$" + Chr(104) + Chr(1) '6 inches
    Public Const eBChqDate As String = Chr(27) + "$" + Chr(40) + Chr(0) '1 inch
    Public Const eBN2W As String = Chr(27) + "$" + Chr(120) + Chr(0) '2 inches
    Public Const eBPayTo As String = Chr(27) + "$" + Chr(40) + Chr(0) '1 inch
    Public Const eBRef As String = Chr(27) + "$" + Chr(40) + Chr(0) '1 inch
    Public Const eBAmount As String = Chr(27) + "$" + Chr(52) + Chr(1) '6.5 inches

    'Description Specific Cheque Alignment
    Public Const eDPayTo As String = Chr(27) + "$" + Chr(40) + Chr(0) '1 inch
    Public Const eDSummary As String = Chr(27) + "$" + Chr(40) + Chr(0) '1 inch
    Public Const eDRef As String = Chr(27) + "$" + Chr(40) + Chr(0) '1 inch

Public Sub PrintBody()

        'Prints information for Body of Cheque
        Dim N2WResult As String

        N2WResult = AmountInWords(txtMAmt.Text)

        Print(eClear + eProSpaceON + eTypeface + ePitch12 + eBChqNum + txtMChqNum.Text + vbCrLf + vbCrLf)
        Print(eBChqDate + DateTimePickerM.Text + eBN2W + N2WResult + vbCrLf + vbCrLf + vbCrLf)
        Print(eBPayTo + txtMPayTo.Text)
        Print(eBRef + "REF:" + txtMRef.Text + eBAmount + "*" + txtMAmt.Text + "*")

    End Sub

    Public Sub PrintFooter()

        Dim formattedDate As Date = DateTimePickerM.Text

        'Prints information for Description of Cheque
        Print(vbCrLf)
        Print(eDPayTo + txtMPayTo.Text)
        Print(eDSummary + "CK#" + txtMChqNum.Text + " " + txtMCurr.Text + "$" + txtMAmt.Text + " " + formattedDate.ToString("MMMM dd, yyyy"))
        Print(eDRef + "REF:" + txtMRef.Text)

    End Sub

The area I am stuck on now is setting the page size. I have the manual for this printer but there is no mention of setting the paper size in it.

1. Would I set the paper size within the driver from the below 2 areas?  If so where exactly would I do this for my custom size and how would the syntax look? For example in the “Printer Commands” section I am not sure what I would input in those boxes.

driver properties
The other question I have regarding the paper size is:

2. Since my paper is a custom size and if I configure the size within the driver, how would this work with setting the “Top Of Form” and the “Tear” for the printer (see: http://my.okidata.com/idocs2.nsf/alldocsweb/586DE6E538F6589A852569290051C7F0?OpenDocument) as I would think both settings from the driver and printer would conflict with eachother wouldn’t they?

I've played around with settings but since I dont really understand it, I feel like I am just wasting time.

Does anyone know how to do this?

Appreciate any assistance.

Kind Regards,
N
ASKER CERTIFIED SOLUTION
Kevin
Information Technology

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros