Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Image Yazdırma
#1
Merhabalar

Formdaki Image nesnesini nasıl yazdırabilirim?

Nette bi çok kod var ama hep yazıcıdan boş kağıt çıkıyor.

Örnek
procedure TKomisyonFisiEvrakF.resim_yazdir(Image:TImage);
var
 ScaleX, ScaleY: Integer;
 RR: TRect;
begin
 with Printer do
 begin
   BeginDoc;
   // Mit BeginDoc wird ein Druckauftrag initiiert.
   // The StartDoc function starts a print job.
   try
     ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
     ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
     // Informationen über die Auflösung
     // Retrieves information about the Pixels per Inch of the Printer.
     RR := Rect(0, 0, Image1.picture.Width * scaleX, Image.Picture.Height * ScaleY);
     Canvas.StretchDraw(RR, Image.Picture.Graphic);
     // An die Auflösung anpassen
     // Stretch to fit

   finally
     EndDoc;   //Methode EndDoc beendet den aktuellen Druckauftrag und schließt die
     // Textdatei-Variable.
     // Steht in finally - um auch bei Abbruch des Druckauftrages Papierausgabe
     // sicherzustellen
   end;
 end;
end;
Cevapla
#2
(07-06-2024, Saat: 18:28)barissagir Adlı Kullanıcıdan Alıntı: Merhabalar

Formdaki Image nesnesini nasıl yazdırabilirim?

Nette bi çok kod var ama hep yazıcıdan boş kağıt çıkıyor.

Örnek
procedure TKomisyonFisiEvrakF.resim_yazdir(Image:TImage);
var
 ScaleX, ScaleY: Integer;
 RR: TRect;
begin
 with Printer do
 begin
   BeginDoc;
   // Mit BeginDoc wird ein Druckauftrag initiiert.
   // The StartDoc function starts a print job.
   try
     ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
     ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
     // Informationen über die Auflösung
     // Retrieves information about the Pixels per Inch of the Printer.
     RR := Rect(0, 0, Image1.picture.Width * scaleX, Image.Picture.Height * ScaleY);
     Canvas.StretchDraw(RR, Image.Picture.Graphic);
     // An die Auflösung anpassen
     // Stretch to fit

   finally
     EndDoc;   //Methode EndDoc beendet den aktuellen Druckauftrag und schließt die
     // Textdatei-Variable.
     // Steht in finally - um auch bei Abbruch des Druckauftrages Papierausgabe
     // sicherzustellen
   end;
 end;
end;

Merhabalar,

uses
  Printers, Vcl.Graphics;

procedure TForm1.Button1Click(Sender: TObject);
var
 PrintBitmap: TBitmap;
begin
 if PrintDialog1.Execute then
 begin
   Printer.BeginDoc;
   try
     PrintBitmap := TBitmap.Create;
     try
       PrintBitmap.Assign(Image1.Picture.Graphic);
       Printer.Canvas.StretchDraw(Rect(0, 0, Printer.PageWidth, Printer.PageHeight), PrintBitmap);
      finally
       PrintBitmap.Free;
     end;
   finally
     Printer.EndDoc;
   end;
 end;
end;
Amaç, bilginin de/aklın da zekat'ını vermek.
Cevapla
#3
(07-06-2024, Saat: 19:49)hi_selamlar Adlı Kullanıcıdan Alıntı:
(07-06-2024, Saat: 18:28)barissagir Adlı Kullanıcıdan Alıntı: Merhabalar

Formdaki Image nesnesini nasıl yazdırabilirim?

Nette bi çok kod var ama hep yazıcıdan boş kağıt çıkıyor.

Örnek
procedure TKomisyonFisiEvrakF.resim_yazdir(Image:TImage);
var
 ScaleX, ScaleY: Integer;
 RR: TRect;
begin
 with Printer do
 begin
   BeginDoc;
   // Mit BeginDoc wird ein Druckauftrag initiiert.
   // The StartDoc function starts a print job.
   try
     ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
     ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
     // Informationen über die Auflösung
     // Retrieves information about the Pixels per Inch of the Printer.
     RR := Rect(0, 0, Image1.picture.Width * scaleX, Image.Picture.Height * ScaleY);
     Canvas.StretchDraw(RR, Image.Picture.Graphic);
     // An die Auflösung anpassen
     // Stretch to fit

   finally
     EndDoc;   //Methode EndDoc beendet den aktuellen Druckauftrag und schließt die
     // Textdatei-Variable.
     // Steht in finally - um auch bei Abbruch des Druckauftrages Papierausgabe
     // sicherzustellen
   end;
 end;
end;

Merhabalar,

uses
  Printers, Vcl.Graphics;

procedure TForm1.Button1Click(Sender: TObject);
var
 PrintBitmap: TBitmap;
begin
 if PrintDialog1.Execute then
 begin
   Printer.BeginDoc;
   try
     PrintBitmap := TBitmap.Create;
     try
       PrintBitmap.Assign(Image1.Picture.Graphic);
       Printer.Canvas.StretchDraw(Rect(0, 0, Printer.PageWidth, Printer.PageHeight), PrintBitmap);
      finally
       PrintBitmap.Free;
     end;
   finally
     Printer.EndDoc;
   end;
 end;
end;

Cevap için çok teşekkür ederim.
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Barkod etiketi yazdırma sorunu Zebra tlp2844 HalilK. 1 134 21-01-2025, Saat: 14:48
Son Yorum: mcuyan
  Image i Siyah beyaz yazdırma barissagir 5 254 16-11-2024, Saat: 15:25
Son Yorum: barissagir
  label creare te caption yazdırma sorunu ercanskose 1 182 12-09-2024, Saat: 11:27
Son Yorum: ercanskose
  Image Compare bydelphi 4 379 01-07-2024, Saat: 08:50
Son Yorum: bydelphi
  FastReport etiketi yan yana yazdırma ( Kapandı ) cinarbil 5 835 12-01-2024, Saat: 17:03
Son Yorum: cinarbil



Konuyu Okuyanlar: 1 Ziyaretçi