Hi,
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);
begin
if frReport1.FinalPass then
frReport1.GetVariableValue('TOTALPAGES', TotalPages );
end;
procedure TXX.frReport1BeginDoc;
begin
frReport1.DoublePass:=true; // important
end;
procedure TXX.PrintReport;
var Lst: TStrings;
begin
Printer.BinName := Lst[TrayNo]; // choose tray with preprinted paper
frReport1.LoadFromFile('FileNameToPrint1); // load lrf-file for preprinted paper
frReport1.PrepareReport;
frReport1.PrintPreparedReport('1', 1); // print only first page
if TotalPages >1 then
begin
Printer.BinName := Lst[TrayNo];
frReport1.LoadFromFile('FileNameToPrint2); // load lrf-file for empty paper
frReport1.PrepareReport;
frReport1.PrintPreparedReport('2-99', 1); // print all further pages on white paper
end;
end;