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

Changing the printer setup between printed pages ?

edited June 2002 in General
I can change the printer setup between pages when I use
Printer.Canvas.TextOut. But I can't do it with a report from ReportBuilder.

What must I do ?

Cheers,

JW Wiggers
IED
The Netherlands

Comments

  • edited June 2002
    I can change the printersetting with reportbuilder for the first page. But
    not for the following pages, the settings still remain.
    I feel that I have to reset the printersettings somehow, somewhere.

    I change the settings in the BeforePrint event of the DetailBand.

    I tried several reset functions of the ppReport1 and the ppPrinter.

    JW Wiggers.


  • edited June 2002
    You need to set the PrinterSetup object on the TppPage objects. Here is an
    example:

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


    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited June 2002

    I tried the solution but I still get the same result.
    Now I change the settings in the OnStartPage event. But the printer copies
    still every page 2 times.

    When I look in the printerdialog I see that the changes were made correctly
    for every page. But when I press the print button it prints every page the
    same times as the first page.

    I attached a file which does the trick, but only with
    Printer.Canvas.Textout. I can't make that example work with reportBuilder,
    maybe you see the trick.

    Cheers

    JW Wiggers


  • edited June 2002
    I see, you just need to add a draw command (TppDrawText) to the TppPage
    object in the Report.OnEndPage event in order to draw some text. The best
    approach to do this is:
    http://www.digital-metaphors.com/tips/AddDrawCommandToPage.zip


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.