Solved

Another print-question!!!!

Posted on 1997-08-25
4
180 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 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