Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print image

Status
Not open for further replies.

jb386

Programmer
Apr 11, 2003
3
AU
Hi
can anyone tell me how to print an image to a specific size (eg 120 mm by 120 mm) thanks in advance
Jim
 
Hi,
You have to manage canvas, which are in pixels, not in mm.
So you have to consider the resolution (pixels x inch).
For example:
If the resolution is 600x600 dpi (Dots=pixels) x inch to draw a picture on 3x3 inches, you should use
Printer.Canvas.StretchDraw(Rect(0,0,1800,1800),Graphic);
to do the same on a 300x300 dpi printer:
Printer.Canvas.StretchDraw(Rect(0,0,900,900),Graphic);

I suggest you to make something proportional using Printer.PageWidth / Height because the width (in inches) remains the same, but the Printer.PageWidth gives you the number of dots (pixels) according to the resolution, so if you use an A4 page (210x297mm) Printer.PageWidth/210 gives you the number of pixels in 1 mm.

To finish:
mmx:=Printer.PageWidth/210;
mmy:=Printer.PageHeight/297;
Printer.Canvas.StretchDraw(Rect(0,0,120*mmx,120*mmy),Graphic);


Ciao,
Geppo Darkson.
 
Thanks guys I appreciate the help
Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top