?
Solved

Another print-question!!!!

Posted on 1997-08-25
4
Medium Priority
?
196 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 320 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

862 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