DELPHI AREA
MESSAGE BOARD
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TPrintPreview - Anybody to help?

 
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products
View previous topic :: View next topic  
Author Message
Kambiz
Administrator


Joined: 07 Mar 2003
Posts: 385
Location: Tehran, Iran

PostPosted: 04/08/04 07:35    Post subject: TPrintPreview - Anybody to help? Reply with quote

sbussinger wrote:
My second problem was also related to GetPrinterPageBounds() routine. It returns values based on the physical size of the page rather than the logical size of the page. In my case that's an issue, but it may be better the way it is for everyone else. My problem arises because inkjets tend to have much larger bottom margins than laser printers and my output was getting cropped. I'd like to propose this change to GetPrinterPageBounds():
Code:
Replace

      Result.Right := GetDeviceCaps(Printer.Handle, PHYSICALWIDTH);
      Result.Bottom := GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT);

with

      Result.Right := GetDeviceCaps(Printer.Handle, HORZRES);
      Result.Bottom := GetDeviceCaps(Printer.Handle, VERTRES);

This would mean that if UsePrinterOptions is true, that the page size is based on the printable area of the page rather than on the full size of the page in question. Any thoughts?


I don't have printer to try sbussinger's suggestion on the other kind of printers. Any help would be appreciated.

Greetings,
Kambiz
Back to top
View user's profile Send e-mail Visit poster's website
aspence
Member


Joined: 11 Jul 2004
Posts: 13
Location: Wolfville, N.S. Canada

PostPosted: 06/08/04 17:18    Post subject: Reply with quote

GetPrinterPageBounds() does what it is supposed to do I believe and that is to return the physical size of the page. What you are probably looking for and what I was looking for at one point was the rectangle that defines the printable area within the page bounds rectangle. I wrote the following routine to do that:

Code:

// This function should be called immediately after 'BeginDoc'
function GetPrintableRect : TRect;
begin
  with PrintPreview do
  begin
    Result.Left   :=
      ConvertUnits(GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX),
      GetDeviceCaps(Printer.Handle, LOGPIXELSX),
      mmPixel, Units);
    Result.Top    :=
      ConvertUnits(GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY),
      GetDeviceCaps(Printer.Handle, LOGPIXELSY),
      mmPixel, Units);
    Result.Right  :=
      Result.Left + ConvertUnits(Printer.PageWidth,
      GetDeviceCaps(Printer.Handle, LOGPIXELSX),
      mmPixel, Units);
    Result.Bottom :=
      Result.Top + ConvertUnits(Printer.PageHeight,
      GetDeviceCaps(Printer.Handle, LOGPIXELSY),
      mmPixel, Units);
  end;
end;

_________________
- Arnold B. Spence
Back to top
View user's profile
Display posts from previous:   
   Reply to topic    DELPHI AREA Forum Index -> DELPHI AREA's Products All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group