Solved

Changing Default printer Dpi from my app

Posted on 1998-09-02
2
488 Views
Last Modified: 2010-04-04
Can anyone tell me how to change the default printer
DPI from my delphi App.
0
Comment
Question by:Asw
2 Comments
 
LVL 4

Accepted Solution

by:
BoRiS earned 100 total points
ID: 1338473
Asw

here is  a code snippet from a guy called lloyd,,.

Note:  Must be called AFTER Printer.BeginDoc.
 --------------------------------------------------------------}

function SetPrinterScale: TPoint;

var
  DeviceDpiX, DeviceDpiY : integer;
begin
  with Printer do begin
    DeviceDpiX := GetDeviceCaps(Handle, LOGPIXELSX);
    DeviceDpiY := GetDeviceCaps(Handle, LOGPIXELSY);
    SetMapMode(Handle, MM_ISOTROPIC);
    SetWindowExt(Handle, DeviceDpiX, DeviceDpiY);
    SetViewPortExt(Handle, DeviceDpiX, DeviceDpiY);
    Result := Point(PageWidth, PageHeight);
    with Canvas do begin
      DPtoLP(Handle, Result, 1); { This API call is required... }
      Font.PixelsPerInch := DeviceDpiY; { Manual setting is required to make this work. }
    end;
  end;
 end;

this function should be what you are looking for...

Later
BoRiS
0
 
LVL 1

Author Comment

by:Asw
ID: 1338474
Thank you
Boris
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

20 Experts available now in Live!

Get 1:1 Help Now