We help IT Professionals succeed at work.

How do you set Paper Size for Dot Matrix Printer?

11,135 Views
Last Modified: 2015-07-22
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

Open in new window


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
Comment
Watch Question

JohnBusiness Consultant (Owner)
Most Valuable Expert 2012
Expert of the Year 2018

Commented:
Here is a solution using a custom form that seems to have worked.

http://forums.codeguru.com/showthread.php?99770-printing-to-a-custom-page-size-dot-matrix-printer

It is an old thread (NT4 Workstation).

Now I print LOTS of cheques. Have you considered voucher cheques?  8.5 x 11. The 8.5 x 7 piece with the cheque goes to the vendor. The remaining piece gets filed with the voucher. Good bookkeeping AND reduces special work.
KevinInformation Technology

Author

Commented:
@John, thank you for your prompt response.

What is mentioned in the solution you sent I have already done as stated in my posting, of defining a custom size. However this seems to have no affect and the printer is still using the default paper size of 8.5 x 11 instead of my custom size of 8.5 x 7.

Do you have any other ideas you could share with me?

Thank you also for your suggestion regarding the voucher check, I do know that management was looking in to this, but for whatever reason decided not to go with it.

Kind Regards,
N
Information Technology
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
KevinInformation Technology

Author

Commented:
Reason for accepting my own comment as the solution is that I was able to resolve the issue on my own.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.