PrintPreview GetPrinterOptions

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

PrintPreview GetPrinterOptions

Postby e.schmidtlein » December 13th, 2007, 7:28 pm

Hi,
I need in my program the PageSize. With 'GetPrinterOptions', the size is correct if the form is in 'Papertype'. If not, the papersize is like 'pA4'.
In 'GetPrinterOptions' I expand the code to

Code: Select all
if (dmFields and DM_PAPERSIZE) = DM_PAPERSIZE then
begin
  SetPaperTypeByID(dmPaperSize);

  if IsCustomPaper then
  begin
    KZ_DrPaper := true;
    DPI.X := GetDeviceCaps(Printer.Handle,LOGPIXELSX);
    DPI.Y := GetDeviceCaps(Printer.Handle,LOGPIXELSY);
    X := GetDeviceCaps(Printer.Handle,PhysicalWidth);
    Y := GetDeviceCaps(Printer.Handle,PhysicalHeight);
    X := ConvertUnits(X,DPI.X,mmPixel,Units);
    Y := ConvertUnits(Y,DPI.Y,mmPixel,Units);
    if Orientation = poPortrait then
      SetPaperSize(X,Y)
    else
      SetPaperSize(Y,X);
  end;
end
else
  SetPaperType(pCustom);
if not KZ_DrPaper then
  if IsCustomPaper then

Now the PageSize is correct. But have you a better way for this problem?
Thanks
e.schmidtlein
e.schmidtlein
Member
Member
 
Posts: 2
Joined: November 29th, 2007, 5:04 pm

Postby Kambiz » December 14th, 2007, 5:02 am

No, I don't have.
I'll update PrintPreview with your code.

Thank you.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 4 guests

cron