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

Printer Bins

edited April 2006 in General
Greetings All

I am having a problem getting a report to select different bins for first
and subsequent pages.

I am using the following code.

procedure ReportOnStartPage
Var
lsBinName: String;

begin
if Report.Groups[0].PageNo = 1 then
begin
lsBinName := Report.PrinterSetup.BinNames[3];
end
else begin
lsBinName := Report.PrinterSetup.BinNames[1];
end;

label3.Caption := lsBinName;
label5.Caption := lsBinName;

Report.PrinterSetup.BinName := lsBinName;
END;


The labels are just to show me that the bin names are being selected OK,
which they are, the initial bin 3 is selected OK. The report then prints all
pages on
that bin ?

This is a 5 page report, basicly rich text paragraphs with a data table, all
grouped on the client number. There are 2k+ reports (clients) to print


Any ideas ?

Versions:
Delphi 7, Reportbuilder 7.04, on XP2


Cheers
David

Comments

  • edited April 2006
    Hi David,

    1. Take a look at the article below. Try using the PrinterSetup object of
    the individual page rather than the report. I believe it is too late to use
    this object.
    2. If you step through your code are you sure the lsBinName is being
    changed to bin 1 as the report generates?

    --------------------------------------------
    Tech Tip: Selecting Paper Bins for Each Page
    --------------------------------------------


    Sometimes you may want to print the first page of a report to the
    manual bin and then print the remaining pages to the default bin.

    You can use the Report.OnStartPage event to set the bin for any page.


    Example:

    procedure TForm1.ppReport1OnStartPageEvent(Sender:TObject);
    var
    lsBinName: String;

    begin

    if ppReport1.AbsolutePageNo = 1 then
    lsBinName := ppReport1.PrinterSetup.BinNames[3]
    else
    lsBinName := ppReport1.PrinterSetup.BinNames[1];


    ppReport1.Engine.Page.PrinterSetup.BinName := lsBinName;


    end;



    Note: The above example assumes the manual bin is 4th in the list
    (remember its a 0 based index). To account for different print drivers,
    you could search for the 'manual' bin in code by performing a search on
    the printer's available bin names:

    for liBin := 0 to ppReport1.PrinterSetup.BinNames.Count-1 do
    if Pos('manual', ppReport1.PrinterSetup.BinNames[liBin]) > 0 then
    begin
    lsBinName := ppReport1.PrinterSetup.BinNames[liBin];
    break;

    end;


    --
    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.