Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Controlling paper feeding from different sources

edited November 2006 in General
Hello

Is it possible to control paper feeding by the RAP ?
We want to provide feeding a last page from the necessary source.

--
WBR Sergey Kovalev svk@siamed.ru
SIA International Ltd

Comments

  • edited November 2006
    Hi Sergey,

    It is possible to control the bin name from RAP using the
    Report.PrinterSetup.BinName. This will only be taken into account before
    the report is printed. If you would like to only print a single page to a
    separate bin, you will most likely need to implement the OnRecievePage event
    of the device (in Delphi) and assign the bin to the PrinterSetup object
    associated with that page.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    Thanks Niko.
    I have tried such code.

    procedure TfmSelectReportLogist.ReportBeforePrint(Sender: TObject);
    begin
    Report.PrinterDevice.OnPageReceive:=PrintLastPageReceive;
    end;

    procedure TfmSelectReportLogist.PrintLastPageReceive(Sender: TObject; aPage:
    TObject);
    begin
    if TppPage(aPage).Final then
    TppPage(aPage).PrinterSetup.BinName:='My name'
    else
    TppPage(aPage).PrinterSetup.BinName:='Default';
    end;

    But some problem exists and I coudn't solve it.
    If a tray has an english name the last page is taken from this tray.
    But if a printer driver is localized and the tray has an russian name the
    paper
    is taken always from 'Default' tray. What do you advice?
    Please check my code into your system - maybe it is written wrong ?

  • edited November 2006
    Hi Sergey,

    Yes, the name will need to be exact for the proper bin to be used. One way
    to handle this is to use the PrinterSetup.BinNames property to access the
    names of the bins available.

    TppPage(aPage).PrinterSetup.BinName :=
    TppPage(aPage).PrinterSetup.BinNames[1];

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    I have tried this yet with HP4000 printer for entire report as well as for
    exact page but without any success.
    I suppose that it is due to driver resources and tray names are russian. And
    paper always goes from 'Default' tray. Is it possible ?


  • edited November 2006
    Hi Sergey,

    Yes, this may have something to do with the Russian names. If you trace
    into this code, what type of names is the BinNames[] property returning or
    is it returning anything at all? You might try using the
    Report.PrinterSetup.BinNames instead.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    Continuing testing with HP4000 I found such interest behaviour.
    If I load the report from the database, open the designer and set up the
    necessary tray in the page properties, paper goes from that tray.
    But if I try to change the tray in the page properties after that, paper
    still goes from the previous tray, that's is not OK. Only reloading the
    report could help.
    What is the cause of that behaviour ? I think exactly this prevents printing
    the last page from another tray.

    --
    WBR Sergey Kovalev svk@siamed.ru
    SIA International Ltd

  • edited November 2006
    Hi Sergey,

    In my quick testing with the code below, I was able to print the last page
    of a report from a separate bin of my printer. Is there something different
    about your application's setup?

    procedure TForm1.PrinterPageReceiveEvent(Sender, aPage: TObject);
    begin
    if TppPage(aPage).PageNo = ppReport1.AbsolutePageCount then
    TppPage(aPage).PrinterSetup.BinName :=
    ppReport1.PrinterSetup.BinNames[4];
    end;

    procedure TForm1.ppReport1BeforePrint(Sender: TObject);
    begin
    if ppReport1.PrinterDevice <> nil then
    ppReport1.PrinterDevice.OnPageReceive := PrinterPageReceiveEvent;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2006
    Thank you very much Nico. All works exactly so as you described. I just
    added something because the report is TwoPass.

    if TppPage(aPage).PageNo = ppReport1.AbsolutePageCount then
    TppPage(aPage).PrinterSetup.BinName := ppReport1.PrinterSetup.BinNames[4]
    else
    TppPage(aPage).PrinterSetup.BinName := ppReport1.PrinterSetup.BinNames[0];

    Now there is only one inconvenience. All works fine when a printer prints
    under an english version of Windows. But if a localized Windows version is
    used, it doesn't. Have you any ideas about it ?

    --
    WBR Sergey Kovalev svk@siamed.ru
    SIA International Ltd

  • edited December 2006
    Hi Sergey,

    If you take a look at what the PrinterSetup.BinNames[i] is returning, how
    does it differ from what the actual bin name is? You might try taking a
    look at the PrinterSetup.PrinterInfo.Capabilities.Bins property. This
    retrieves a similar array to the PrinterInfo.Capabilities.BinNemes that
    could possible help you find the correct bin to use.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.