Print report to two printers - big problem

Hi folks!


I have a big problem to print report (from database) to two printers (restaurant and copy to kitchen).

One of them works perfect, but simultanous two make crash.

This code prepare data:

 with DM.qrydruk_lines, SQL do // get lines
 begin
  Close;
  Clear;
  Add('select * from linie where bill=:bil; and storno=:storno order by id');
  ParamByName('bill').AsInteger := main.bill_id;
  ParamByName('storno').AsBoolean := False;
  Open;
  First;
 end;

 with DM.qrydruk_bill, SQL do // get bill
 begin
  Close;
  Clear;
  Add('select * from bill where id=:id');
  ParamByName('id').AsInteger := main.bill_id;
  Open;
 end;


This is my code to first print:

 main.frxReport1.LoadFromFile('wydruki\zlecenie.fr3');
 main.frxReport1.PrintOptions.ShowDialog := False;
 main.frxReport1.PrintOptions.Copies := 1;
 main.frxReport1.PrintOptions.Printer := main.Konfiguracja.drukarka_kuchenna;  // name first printer
 main.frxReport1.SelectPrinter;
 main.frxReport1.PrepareReport;
 main.frxReport1.Print;


and this is code to second print:

 main.frxReport1.PrintOptions.Printer := main.Konfiguracja.drukarkakuchennakopia;  // name second printer
 main.frxReport1.SelectPrinter;
 main.frxReport1.Print;


I did short film to explain problem.



(second printer works slow but this is not fastreport fault - is little damaged. On new printer this works same)


Of course I tried a lot of ways (thread, timer) and if I wait after first print (aproximaly 200 ms for line) second print works. But this app is for restaurant and employes don't want wait :(.


This look like fastreport after first print demaged data for short time?


Do you know any solutions?


Regards

Robert

Comments

  • Try to use TfrxPreview.Print instead of main.frxReport1.Print;

  • Can I ask you for more details?

    Maybe some code?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.