Forum > Graphics

canvas + create loyout to print

(1/3) > >>

nicolas_lazarus:
This is my first post in this forum and I hope you understand me because my english is not so good :D

I was looking for some ideas to create a layout to print a number of pictures.
To be clear I made a picture.

I want to include some jpg inside another jpg. Finally i want to print the resultant image.
The number of pictures to include it is depend the size of each jpg picture and it is depend the size of the paper to print.

As you can see in the attached picture, the work is related to medical images.
Maybe i can use the canvas component but I am not really sure if this is the best option.

Please, can someone give me a suggestion ?
or some article to read ?

Thanks in advance!!!

Nicolas

theo:
Use "Printer.Canvas"

You need "Uses Printers" and the dependency "Printer4Lazarus".
The latter is automatically added to your project, if you drop for ex. a TPrintDialog on the form.

nicolas_lazarus:
Hi Theo,


I will take a look to "Printer.Canvas" and "Printer4Lazarus".

I need to do a pre-view of the resultant image to send to another application running over the WEB, then i need to send the same image to the printer.

So, I guess i can use canvas on a (empty) picture?? to add a few pictures, finally if the users says OK I will send the image to the printer.

I will read more and then I will write here again.

Thanks!
Nicolas

nicolas_lazarus:
Hi all !

I was working trying to resize a bitmap, but it doesn't work.
Can someone see what am I doing wrong ?

this is the code:


--- Code: ---function TPrinterFunctions.resizeBitmap(printer_name: string; Source: TBitmap): TBitmap;
var
  res: TBitmap;
  lwidth, lheight: integer;
  destination: TRect;
begin
  res := TBitmap.Create;
  lwidth := getPrinterPageWidth(printer_name) div 2;
  lheight := getPrinterPageHeight(printer_name) div 2;
  res.Width := lwidth;
  res.Height := lheight;
  destination.Top := 0;
  destination.Left := 0;
  destination.Right := lwidth;
  destination.Bottom := lheight;
  res.Canvas.CopyRect(destination, Source, destination);
  res.SaveToFile('C:\Users\Nicolas\Desktop\este\printerjob\afterResize.bmp');
  Result := res;
end;
--- End code ---

The original image is (bmp):
look at beforeResize.jpg (1024 X 2014)
The image after resize it  is(bmp):
look at  afterResize.jpg (437 X 616)

Hope you can help me !

Thanks in advance !
Nico

jesusr:
Have you checked the lazarus/components/printers/samples/dialog sample?, it shows how to scale one image in order to print it.

Navigation

[0] Message Index

[#] Next page

Go to full version