Click here to Skip to main content
14,449,862 members
Rate this:
Please Sign up or sign in to vote.
Crystal Reports: Selecting PaperSource


when i select with printer with print as per tray 2 like lower tray or casttle 2 then it will take default tray 1 what is issue can you please help me experts..?

What I have tried:

dim rpt as new crystlRptNm

1. rpt.PrintOptions.PaperSource = CrystalDecisions.[Shared].PaperSource.Cassette
'Failed - taking default Printer


2. rpt.PrintOptions.CustomPaperSource = PrintDialog1.Document.DefaultPageSettings.PaperSource
' GETTING ERROR like :
Method invocation failed because 'Public Overrides Property CustomPaperSource() As System.Drawing.Printing.PaperSource' cannot be called with these arguments:
    Argument matching parameter 'value' cannot convert from 'PaperSourceCollection' to 'PaperSource'.

3. rpt.PrintOptions.CustomPaperSource = PrintDialog1.PrinterSettings.PaperSources
Method invocation failed because 'Public Overrides Property CustomPaperSource() As System.Drawing.Printing.PaperSource' cannot be called with these arguments:
    Argument matching parameter 'value' cannot convert from 'PaperSource' to 'PaperSource'


4. rpt.PrintOptions.PaperSource = CrystalDecisions.[Shared].PaperSource.Lower
' Taking default: i.e. Upper Tray with blank copy



Last Line to Print is

rpt.PrintToPrinter(1, True, 0, 1)
Posted
Updated 11-Feb-20 20:16pm
Rate this:
Please Sign up or sign in to vote.

Solution 1

Please, read this: Print a crystal report from two trays.[^]

Quote:
Hello,

These types of issues can get a little complicated so I pinged one of the resources on the developer support team. Here is his response with a few edits for clarity:

There's a lot of things to check for. The first thing is make sure that the latest hot fixes are installed. We have fixed a couple of known issues.

(here is the link to the download page, make sure that you find the right match for your product and version)

SAP Support Portal Home[^]

Secondly, make sure the report is based on the default printer.

Sometimes, checking "No Printer", saving the report, and then unchecking it will clear whatever is saved with the report and reset itself to the default printer.

Next, when setting the PaperSource property, the enums being used are taken from the .NET Framework defaults, which don't always match to the constants used by the printer driver. In other words, each printer driver uses constant values to enumerate the available trays for the printer. These constants may not match what is provided by the CrystalDecisions.[Shared].PaperSource enums. So you have to get these constants from the driver itself, outside of CR. There is a Microsoft sample that helps identify the constants for a particular printer.


Link:

http://www.microsoft.com/downloads/details.aspx?FamilyID=f95a5211-e272-4e02-a6e2-11e7f5dbd973&displaylang=en[^]

or

http://support.microsoft.com/kb/q132239/[^]


Once you have that value, you can pass it to Crystal. If this doesn't work, then I suggest calling Customer Support.

Here is the link for contacting support:

SAP Support Portal Home[^]
   
v2
Comments
hareshdgr8 10-Feb-20 2:50am
   
SIR, I JUST SELECT PRINTER NAME FROM PRINTER DIALOGUE AND SELECT TRAY SELECT FROM PAPER SOURCE FROM SAME PRINTER DIALOGUE WHY IT IS NOT PRINTING AFTERWORDS THAT I DONT UNDERSTAND PLEASE HELP ME OUT ABOVE TWO LINK NOW WORK SAP SUPPORT WORK BUT IT won't HELP TO ME BECAUSE I AM DEVELOPER WHO IS USING FREE ONE.
phil.o 10-Feb-20 4:49am
   
Why are you shouting? :)
hareshdgr8 10-Feb-20 4:58am
   
no sir i am not shouting sir.. i am just telling you that i did this way sir...
please dont take me wrong sir...
phil.o 10-Feb-20 5:07am
   
I was asking because using all-capital-letters is considered as shouting.
hareshdgr8 10-Feb-20 5:09am
   
ohh that i dont know actually while typing my caps lock is on sir thats why i dont know about this thing sorry if you feel i am shouting...
sir could you please reply me about my query if you know answer ...

please help me out sir..
phil.o 10-Feb-20 5:23am
   
Unfortunately, I don't have an answer for you. Have you followed what Maciej has provided yet? There is a lot to check for in there.
hareshdgr8 10-Feb-20 5:25am
   
yes sir actually as per them and my query both are diff. in stage because i just want to sent tray name with printing crystal report as per client selection.
Rate this:
Please Sign up or sign in to vote.

Solution 2

For Each PSource In PrintDialog1.PrinterSettings.PaperSources

                                   If PSource.SourceName.ToUpper() = strTray.ToUpper Then
                                       rpt.PrintOptions.CustomPaperSource = PSource

                                       Exit For
                                   End If

                               Next


This will resolve my issue
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100