fastreport'da yazıcıya direk gönderme ile ilgili..
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
fastreport'da yazıcıya direk gönderme ile ilgili..
selam arkadaşlar..Projemde fastreport 2.xx sürümünü kullanarak fatura ve irsaliye yazdırıyorum.Minik bir sorun var windowsda Inkjet yazıcı varsayılan yazıcı olarak ayarlı ama irsaliye ve faturayı ben dotmatrix yazıcıdan yazdırmak zorundayım normal olarak.Kullanıcı herseferinde printdialogdan(fastreportun otomatik çıkardığı) yazıcı seçmek zorunda kalıyor.Acaba ben fastreportan yazıcıyı gönderdiğimde otomatik olarak dotmatrix olan yazıcıyı seçmesini sağlayabilirmiyim.Mesela sabit tanımlar modülünden bir kereye mahsus kullanıcı fatura ve irsaliyenin yazdırılacağı printerı seçip kaydetse gibi...Kolay gelsin..
ChangePrinter'ı kullanabilirsin. Şöyle bir kod buldum işine yarayabilir.
Kolay gelsin.
Kod: Tümünü seç
uses printers,....
....
....
....
var
printer:TPrinter;
index:integer;
begin
printer:= TPrinter.Create;
printer.Printers;
//ListBox1.Items:=printer.Printers;//if it is necessary possible to take list a printer
index:=printer.PrinterIndex;//take current printer
frReport1.ShowPrintDialog:=false;
//we print 1-ouch report on 2 printer
frReport1.LoadFromFile('rep1.frf');
frReport1.ChangePrinter(index,2);//change printer with the current index on printer with index 2.
frReport1.PrepareReport;
frReport1.PrintPreparedReportDlg;
//frReport1.PrintPreparedReport();//possible in the same way use this function
//we print 2-ouch report on 3-m printer
index:=printer.PrinterIndex;//take current printer
frReport1.LoadFromFile('rep2.frf');
frReport1.ChangePrinter(index,3);//change printer with the current index on printer with index 3.
frReport1.PrepareReport;
frReport1.PrintPreparedReportDlg;
end;
Fast-Report.com forumdan 2. alıntı.
Use the TFRReport.ChangePrinter(OldIndex,NewInde:Integer):Boolean
function to change the output printer without using any customizable
printer setting dialogs. The parameters are the same as the reference
indexes in the Printer.Printers array. My preferred way to implement
this on the GUI: populate a combobox with the Printer.Printers list and
then let the user choose one from the list.
So:
-1 for the OldIndex parameter cause the report to use the original
index, so You don't need to know the previous index.
Use the TFRReport.ChangePrinter(OldIndex,NewInde:Integer):Boolean
function to change the output printer without using any customizable
printer setting dialogs. The parameters are the same as the reference
indexes in the Printer.Printers array. My preferred way to implement
this on the GUI: populate a combobox with the Printer.Printers list and
then let the user choose one from the list.
So:
Kod: Tümünü seç
Uses System,....,...,Printers;
YourForm.OnCreate(Sender:TObject);
Begin
PrinterCombo.Items.Assign(Printer.Printers);
End;
TYourForm.PrintButtonClick(Sender:TObject);
Begin
Report.LoadFromFile(...);
Report.ChangePrinter(-1, PrinterCombo.ItemIndex);
Report.Prepare;
...etc.
End;
index, so You don't need to know the previous index.
ben 3.18 söle kullanabiliyorum
ama tabi siz 2.xx demişiniz...
Kod: Tümünü seç
frxReport1.PrintOptions.Printer:='Adobe PDF';
Siz hayal edin...Biz yapalım TuannaSoft...