Recent

Author Topic: Printing a image - TFPMemoryImage images - Not BitMap  (Read 6478 times)

nicolas_lazarus

  • New Member
  • *
  • Posts: 42
Printing a image - TFPMemoryImage images - Not BitMap
« on: September 03, 2010, 03:17:55 pm »
Hi all !

I'm working in web application, so I have to use FPImage to get some jpg pictures.

The problem is that i am working with TFPMemoryImage and i need to send a Bitmap to the printer.



Code: [Select]

  begin
    Printer.BeginDoc;
    Printer.Title:=job_name;
    Printer.Canvas.StretchDraw(Rect(0, 0, Printer.PageWidth, Printer.PageHeight),imageToPrint);
    Printer.EndDoc;
  end;


I cannot use imageToPrint like TFPMemoryImage,  because the Printer.Canvas.StrechDraw expect a graphic component.

So, what can I do ?

Thanks in advance.
Nico.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Printing a image - TFPMemoryImage images - Not BitMap
« Reply #1 on: September 03, 2010, 11:03:38 pm »
How do you have a printer object without the LCL and the Printers4Lazarus package?

nicolas_lazarus

  • New Member
  • *
  • Posts: 42
Re: Printing a image - TFPMemoryImage images - Not BitMap
« Reply #2 on: September 09, 2010, 08:44:15 pm »
Hi !

We are using printer with LCL and the Printers4Lazarus .

What sholud we use ?

Regards,


mas steindorff

  • Sr. Member
  • ****
  • Posts: 437
Re: Printing a image - TFPMemoryImage images - Not BitMap
« Reply #3 on: September 10, 2010, 02:49:28 am »
did you try
var imageToPrint: TBitmap;

imageToPrint :=TFPMemoryImage.Create (100,100); or some thing like this

http://wiki.freepascal.org/fcl-image

shows the a TFPCustomImage can be init with a TFPMemoryImage.create()
and a TBitmap is derived from some common classes 

http://lazarus-ccr.sourceforge.net/docs/lcl/graphics/tbitmap.html

Inheritance
TBitmap
   
 TBitmap is the data of an image, and can be loaded from a file, stream or resource in .bmp or .xpm format
 
|
TFPImageBitmap
   
 A class of Bitmap using the FPImage reader and writer (ie customised for FreePascal)
 
|
TCustomBitmap
   
 TCustomBitMap - the base class for TBitmap
 
windows 7/10 - laz 2.0 / 1.2.6 general releases