Solved

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

Posted on 2006-11-09
2
370 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
2 Comments
 
LVL 1

Accepted Solution

by:
TerryInOhio earned 125 total points
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

762 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

9 Experts available now in Live!

Get 1:1 Help Now