Solved

Another print-question!!!!

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree compare node issue 14 116
Run video youtube webbrowse 10 61
Find and Replace Stream with 0s 8 62
Firemonkey webbrowser scrollbars ? 1 38
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

770 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