Author Topic: (SOLVED) How to print a multipage report from different paper trays  (Read 1826 times)


  • New Member
  • *
  • Posts: 10
I require an idea for printing an invoice on different papers.
First page should be printed on a preprinted form from paper tray one,
all next pages should be printed on blank paper from second paper tray.
Is there a solution to do this in Lazreport ?

Win 10, 32 Bit, Lazarus 1.6, Lazreport 0.9.9 

I made further investigations and found a solution. I am not sure if this is perfect or good programming style but it works and is maybe helpful.
Here the code:

var               // declare Totalpages
   TotalPages : Variant ;

procedure TXX.frReport1BeginBand(Band: TfrBand);     
  if frReport1.FinalPass then
   frReport1.GetVariableValue('TOTALPAGES', TotalPages );

procedure TXX.frReport1BeginDoc;
  frReport1.DoublePass:=true;           // important

procedure TXX.PrintReport;
var  Lst: TStrings;


     Printer.BinName := Lst[TrayNo];            // choose tray with preprinted paper
     frReport1.LoadFromFile('FileNameToPrint1); // load lrf-file for preprinted paper
     frReport1.PrintPreparedReport('1', 1);   // print only first page

      if TotalPages >1 then         
        Printer.BinName := Lst[TrayNo];
        frReport1.LoadFromFile('FileNameToPrint2); // load lrf-file for empty paper
        frReport1.PrintPreparedReport('2-99', 1);  // print all further pages on white paper
« Last Edit: July 08, 2017, 08:00:50 pm by luckylynx »