Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-11-09
2
Medium Priority
?
377 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 500 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

722 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