fastreport'da yazıcıya direk gönderme ile ilgili..

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
serkan
Üye
Mesajlar: 666
Kayıt: 10 Tem 2003 12:08
Konum: bursa

fastreport'da yazıcıya direk gönderme ile ilgili..

Mesaj gönderen serkan »

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..
Kullanıcı avatarı
mussimsek
Admin
Mesajlar: 7604
Kayıt: 10 Haz 2003 12:26
Konum: İstanbul
İletişim:

Mesaj gönderen mussimsek »

ChangePrinter'ı kullanabilirsin. Şöyle bir kod buldum işine yarayabilir.

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;
Kolay gelsin.
Kullanıcı avatarı
mussimsek
Admin
Mesajlar: 7604
Kayıt: 10 Haz 2003 12:26
Konum: İstanbul
İletişim:

Mesaj gönderen mussimsek »

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:

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;
-1 for the OldIndex parameter cause the report to use the original
index, so You don't need to know the previous index.
serkan
Üye
Mesajlar: 666
Kayıt: 10 Tem 2003 12:08
Konum: bursa

Mesaj gönderen serkan »

hocam eline sağlık.en kısa zamanda deneyip sonucu yazarım.Umarım olur.İyi akşamlar..
Kullanıcı avatarı
tuanna
Üye
Mesajlar: 582
Kayıt: 06 Ara 2004 05:01
Konum: Ankara
İletişim:

Mesaj gönderen tuanna »

ben 3.18 söle kullanabiliyorum

Kod: Tümünü seç

frxReport1.PrintOptions.Printer:='Adobe PDF';
ama tabi siz 2.xx demişiniz...
Siz hayal edin...Biz yapalım TuannaSoft...
kayipgemi
Üye
Mesajlar: 88
Kayıt: 14 Kas 2005 03:07

Mesaj gönderen kayipgemi »

mustafa hocam eline sağlık .. bu çok iyi oldu şu saate kadar epey kazındım..

emeğine sağlık teşekkürler cok faydalı oldu...

kolay gelsin
Cevapla