Skip to Content
author's profile photo Former Member
Former Member

Setting PaperSource

I am having a difficult time getting our printers to print from a specific tray. I have set the papersource property to Upper, Lower, Middle, even Manual, and I cannot get the printer to choose the tray that I am sending. I have tried checking the No Printer option in Page Setup and checked the Dissociate Formatting Page Size and Printer Paper Size to no avail.

Any thought, Ideas...

Thanks,

Brad clark

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2010 at 04:25 PM

    This code works for me:

    Public Function GetPaperSizeIndex(ByVal PaperName As String, Optional ByVal Impresora As String = "") As Integer
            If PaperName.Trim.Length = 0 Then Return -1
    
            If _PaperSizeArrayList Is Nothing OrElse _PaperSizeArrayList.Count > 0 OrElse Impresora <> _ultPrinterName Then
                _PaperSizeArrayList = Me.GetPaperSizeList(Impresora)
                _ultPrinterName = Impresora
            End If
    
            Try
                For i As Integer = 0 To PaperSizeArrayList.Count
                    Dim wcomboitem As clsComboItem = PaperSizeArrayList.Item(i)
                    If UCase(PaperName) = UCase(wcomboitem.getDescripcion) Then
                        Return wcomboitem.getValor
                    End If
                Next
            Catch ex As Exception
                Throw ex
            End Try
    
            Return -1
    
        End Function

    and to get de PaperSizeArrayList:

    Private _PaperSizeArrayList As New ArrayList
    
    Public Function GetPaperSizeList(Optional ByVal printername As String = "") As ArrayList
    
            _PaperSizeArrayList.Clear()
    
            Dim printdoc As New System.Drawing.Printing.PrintDocument
    
            Try
    
                If printername <> "" Then
                    printdoc.PrinterSettings.PrinterName = printername
                End If
    
                For Each pksize As PaperSize In printdoc.PrinterSettings.PaperSizes
                    _PaperSizeArrayList.Add(New clsComboItem(pksize.RawKind, pksize.PaperName))
                Next
    
            Catch ex As Exception
                MsgBox("GetPaperSizeList:" & ex.Message)
            End Try
    
            Return _PaperSizeArrayList
    
        End Function

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 02, 2010 at 08:18 PM

    You will probably have to find the enum for the tray and set that. Download the devcap utility from here:

    https://sapmats-us.sap-ag.de/download/download.cgi?id=8XWQKVKRIOFDVEB813HXKX252LGSM5GPSVZSLOVS7AII3WTJVZ

    and see what it tells you for the enum. Then set that to the PaperSource property in your code.

    Ludek

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ludek Uher

      When I run the program I get the following:

      Bin Info:

      Supported Bin Types:

      15 USER DEFINED

      259 USER DEFINED

      258 USER DEFINED

      257 USER DEFINED

      Named bins:

      Automatically Select

      Cont. Feed - No Break

      Cut Sheet

      Cont. Feed - With Break

      Let me give you a little more detail. I am writing a DOT Net application that calls a Crystal Report and prints it to a defined tray. I need this application to work so we can get rid of a piece of software that we are using called "Optio". This "Optio" software uses the exact same driver (from the same server) as the one I pulled the information from above using the DevCap utility. The Optio application is set to print to "Upper" and it works. Although, no matter what I do everything prints to the Tray 1 manual. They have the printer loaded with White Paper in the manual tray and Yellow paper in the Tray 1 (upper tray).

      I have tried the following "PaperSource" values:

      PaperSouce.Lower

      PaperSouce.Middle

      PaperSouce.Upper

      PaperSouce.Manual

      Then, I tried the values from above:

      15

      257

      258

      259

      Also, I tried using the other suggestion and setting the "RawKind". I queried the PaperSources using the code provided and retrieved the value for the "Tray 1" and used that.

      All of these just send the output to the White Paper in the "flip-out" Tray 1 "Manual" tray...

      Any suggestions, anyone?

  • author's profile photo Former Member
    Former Member
    Posted on Aug 21, 2013 at 06:28 PM

    In the spirit of hopefully helping someone out, here's what worked for me:

    Within Crystal Reports, the Print Setup was set to use "letter" size paper. But no matter which PaperSource I selected, the job always printed to the lower tray, which happens to be filled with letter-size paper.

    The fix was to also set the PaperSize value...

    1. to match the media in the specified PaperSource,
    2. and to overrule the setting within the RPT file.

    So in my case, this failed to take effect:

    CReport.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Middle

    But this succeeded:

    CReport.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLegal

    CReport.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Middle

    The lesson learned was that if the PaperSize setting in the RPT file does not match up to the actual physical paper size specified PaperSource setting in code, the print job will automatically switch over to another PaperSource that does have the correct media size. Which will present to you as "no matter what I do, it doesn't work!"

    I ended up using this code to achieve what I needed:

    CReport.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter

    CReport.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Lower

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.