Delphi Can

Orjinalini görmek için tıklayınız: Image Yazdırma
Şu anda (Arşiv) modunu görüntülemektesiniz. Orjinal Sürümü Görüntüle internal link
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;
(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;
(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.