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

Printer Tray Selection

Hi,

I have created a series of reports in CR2011 and I am using a VB2010 application to allow users to print them, there's one small problem however....

The printer we are using is an HP4015 which has 5 paper trays, each tray contains a different colour paper. I have 5 reports that are used, and each report needs to be printed on the appropriate colour paper.

I have set the paper tray within CR2011 for each report, and when I print the report within CR2011 each report goes to the appropriate paper tray/colour. However when I use my application to print the reports they always print to the default paper tray.....

I have tried to be clever and have set the paper tray paper type on the printer to be "Preprinted" in tray 2 and the set the paper type within CR2011 to use "Preprinted" paper as well as using tray 2... and yet the application still uses the default paper tray...

I checked out the PrintOptions.PaperSource property but that only includes constants for top middle and bottom trays, and I have 5 potential trays to use..

The code I am using isnt exactly rocket science either...

Dim rptReport As ReportDocument

rptReport.Load(sTray2File)

rptReport.RecordSelectionFormula = "{NoteDefinition.NoteID} = 1111"

rptReport.PrintToPrinter(1, False, 0, 0)

sTray2File is a string that contains the full path and filename of the rpt file to be printed to tray 2, it does load the correct file.

The RecordSelectionFormula would usually be a bit more meaningful.. but I just put the 1111 to try and resolve any issues...

It really doesnt make much sense to me why my program is not printing to the tray that is defined with the .rpt.

Any help would be greatly appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Aug 15, 2011 at 09:16 PM

    So I'm going to assume you are using Cr for VS 2010 since it's a free download and only one supported in VS 2010.

    I had a look and none of our Printer API's, not even the PrintOutputController, has the printer tray variable that we can get from the RPT.

    Only way I can think of to do this is to use the SummaryInfo API's ( not the column summary info but the report summary info ) to save the printer tray the report is to use.

    Then go in and define 5 Printers, each one defaults to each tray. Then get the info and set the Printer to that Printer as defined in Windows....

    Add your request to get the Tray value to Idea Place, top right corner of this page, and if enough people vote on it the PM's will look at adding a GetTray member to API list.

    Thank you

    Don

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 16, 2011 at 12:55 PM

    Hi,

    Thanks for the answers and suggestions.. I'll give you some of the info you have requested

    I am using the retail version of Crystal reports 2011 to create the reports, and as you summised I am using the CR2010 free download within Visual Studio 2010. I am using VB.

    As mentioned when the report is printed from CR2011 the report prints correctly to the specified tray, I have set the printer and tray number within CR2011. When I preview the report within my VS2010 app and then print it from the preview the report goes to the correct tray. However when I print to printer directly using the code I pasted in my original post the printer goes to the default tray, but it does go to the correct printer.

    The option of adding multiple copies of the printer is no really viable as we have an office of 80+ staff, and 5 (soon be 7 multibin printers) so we would need to add 35 printers to the users to allow them to print the each of the printers.

    I know this isnt really relevant, but the previous version of the app was written in VB6 using CR8.5 and it worked as expected. I cant understand why the print tray from the RPT file is ignored, whereas the printer is not ignored.

    Edited by: Daftwader on Aug 16, 2011 3:01 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 15, 2011 at 09:02 PM

    Hi Daft,

    What SDK are you using and what Dev language and tool?

    Thanks

    Don

    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.