Solved

Another print-question!!!!

Posted on 1997-08-25
4
165 Views
Last Modified: 2012-05-07
I print my image like this....
Printer.Canvas.StretchDraw(200,200, Image1.Picture.Graphic);
However, the functionality seems to be depending on my printer´s resolution: If I change the resolution of the printer from 360 dpi to 180 dpi, the image changes location on the page, and size aswell. There must be some printer-independent procedure's in Delphi, but I have trouble finding them.
I run Delphi Developer 2.0
Thanks!!
Erik N
0
Comment
Question by:Erik N
  • 2
4 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1342392
You must read you'r printer resolution and then draw on good place. Delphi have not printer independent procedure.
Try GetDeviceCaps.
0
 
LVL 8

Accepted Solution

by:
ZifNab earned 80 total points
ID: 1342393
Try this, is example for GetDeviceCaps like mirek says:

procedure TForm1.Button1Click(Sender: TObject);
var
  ScaleX, ScaleY: Integer;
  R: TRect;
begin
  Printer.BeginDoc;  
  with Printer do
  try
    ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
    ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
    R := Rect(0, 0, Image1.Picture.Width * ScaleX,
      Image1.Picture.Height * ScaleY);
    Canvas.StretchDraw(R, Image1.Picture.Graphic);
  finally
    EndDoc;
  end;
end;
0
 

Author Comment

by:Erik N
ID: 1342394
Thank you very much for your excellent answer, ZifNab!!
Erik N.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1342395
Glad I could help you!
Hope, you'll help us too when we've got a problem.

Have fun,
c.u. ZifNab.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now