Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Another print-question!!!!

Posted on 1997-08-25
4
Medium Priority
?
195 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
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

636 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