Solved

Printing DataReport is different on different printers, cutting off last line (Please Help)

Posted on 2006-11-09
2
375 Views
Last Modified: 2012-06-27
Ok, I'm writing this program, and one of the things it does is use a datareport I've drawn up. It's got three labels across, and the idea is that it's an exact template for a particular 3x10 avery mailing labels. I've tested this on like 6 different printers at my work where I'm writing this, and we're trying to get the program ready to release. Anyways, one of the people who's testing it for us has a

    Brother MFC 9600 printer.

Anyways, here's what's going on, I can't figure out why his printer is doing this, since none of the others we've tested this on do this, but his printer is cutting off the last line. I'm wondering if anyone knows a way I could fix this so that he too could use our program?

Thanks! ~ Michael

'Here is all the related source code I use to display the datareport. I'm hoping that there is just something wrong with my code and all and it's not the printer, but if it isn't the code, is there a way to set the printer so it works anyways?

Dim myPrinter As Printer

Private Const OneInchInTwips = 1440     '1440 is equal to 1 inch
Private Const cLandscapeW = 1440 * 10
Private Const cLandscapeH = 1440 * 8
Private Const cPortraitW = 1440 * 8.5
Private Const cPortraitH = 1440 * 11

Private Sub btnLabels_Click()
    mnuPrintLabels_Click
End Sub

Private Sub mnuPrintLabels_Click()
    setPrinterMargins
On Error GoTo myerrhandler
    Set myDB.myLabelsSet = Nothing
    Set myDB.myLabelsSet = New ADODB.Recordset
    myDB.fillMailingTableFromRS
    DataReport1.LeftMargin = 0
    DataReport1.RightMargin = 0
    DataReport1.TopMargin = 0
    DataReport1.BottomMargin = 0
    setPortrait
    setSimplex
    '= vbPRDPSimplex  'print one side
    DataReport1.Orientation = rptOrientPortrait
    DataReport1.ReportWidth = cPortraitW
    DataReport1.Height = cPortraitH     'changed because page was cutting off
    Set DataReport1.DataSource = myDB.myLabelsSet
    DataReport1.Show
    Exit Sub
myerrhandler:
    MsgBox "Unable to display report. Try changing your `default printer' to a different printer."
    Err.Clear
    Exit Sub
End Sub


' --- Printer Config

Private Sub setPrinterMargins()
    Printer.ScaleLeft = 0
    Printer.ScaleTop = 0
    Printer.ScaleWidth = cPortraitW '11558
    Printer.ScaleHeight = cPortraitH    '15360
End Sub

Private Sub setPortrait()
    myPrinter.Orientation = vbPRORPortrait
    'Printer.Orientation = vbPRORPortrait
    'Set Printer = myPrinter
End Sub

Private Sub setLandscape()
    On Error GoTo setlandscapeerr
    Printer.Orientation = cdlLandscape
    'Set Printer = myPrinter
    Exit Sub
setlandscapeerr:
    Debug.Print Err.Description
    If InStr(Err.Description, "Invalid property value") > 0 Then
        Err.Clear
        'MsgBox "Your printer does not support Landscape Mode."
        Exit Sub
    End If
    Err.Raise Err.Number
End Sub

Private Sub setDuplex()
    'myPrinter.Duplex = 2
    On Error Resume Next
    Printer.Duplex = 2
    'Set Printer = myPrinter.
End Sub

Private Sub setSimplex()
    'myPrinter.Duplex = 1
    On Error Resume Next
    Printer.Duplex = AcPrintDuplex.acPRDPSimplex
    'Set Printer = myPrinter
End Sub
0
Comment
Question by:JeffreyDurham
[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 Comments
 
LVL 1

Accepted Solution

by:
TerryInOhio earned 125 total points
ID: 17914086
Print a page full text maybe from Word with the margins as small as you can get them on both a good and bad printer, compare the results.  If different it can't be your code.

I see your margins are all 0.  The HP printers I use can't handle anything smaller than .17 or .25, maybe that is confusing the printer.

Your code is probably fine, when strange things happen like yours to me, I suspect the print driver, perhaps reload it.

Maybe even move that printer to another computer for a test to see if it acts differently.

0
 

Author Comment

by:JeffreyDurham
ID: 17949744
Ok, I was able to fix it, and you were correct. The issue was that all the margins were set to 0 and his printer therefore supplied a default value which caused the last set of labels not to fit on the page. I changed them to a quarter inch on each side (left/right) and on the top and bottom set it to (half in. + quarter in.) /2 which yielded a working result.

Thanks for your advice!
~Michael
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

617 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