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