у меня не работает. Если название размера задавать, то ОК, а вот прямое указание - не хочет.
TPrinterWin(Printer).GetPrinter(Device, Driver, Port, DeviceMode);
DevMode := GlobalLock(DeviceMode);
if DevMode <> nil then
try
DevMode.dmFields := DevMode.dmFields or DM_PAPERSIZE or DM_PAPERLENGTH or DM_PAPERWIDTH;
DevMode.dmPaperSize := DMPAPER_USER;
DevMode.dmPaperWidth := round(Widthmm * 10);
DevMode.dmPaperLength := round(HeightMM * 10);
TPrinterWin(Printer).SetPrinter(Device, Driver, Port, DeviceMode);
finally
GlobalUnlock(DeviceMode);
end;
В Fr в D7 такая процедура, но не пробовала. Очень похоже) procedure TfrPrinter.SetSettings; var i, n: Integer; begin if FPrinterIndex = FDefaultPrinter then begin FPaperNames.Clear; for i := 0 to PAPERCOUNT - 1 do begin FPaperNames.Add(PaperInfo[i].Name); PaperSizes[i] := PaperInfo[i].Typ; if (PaperSize <> $100) and (PaperSize = PaperInfo[i].Typ) then begin PaperWidth := PaperInfo[i].X; PaperHeight := PaperInfo[i].Y; if Orientation = poLandscape then begin n := PaperWidth; PaperWidth := PaperHeight; PaperHeight := n; end; end; end; PaperSizesNum := PAPERCOUNT; Exit; end; FPrinter.GetPrinter(FDevice, FDriver, FPort, FDeviceMode); try FMode := GlobalLock(FDeviceMode); if PaperSize = $100 then begin FMode.dmFields := FMode.dmFields or DM_PAPERLENGTH or DM_PAPERWIDTH; FMode.dmPaperLength := PaperHeight; FMode.dmPaperWidth := PaperWidth; end else FMode.dmFields := FMode.dmFields and not (DM_PAPERLENGTH or DM_PAPERWIDTH); if (FMode.dmFields and DM_PAPERSIZE) <> 0 then FMode.dmPaperSize := PaperSize; if (FMode.dmFields and DM_ORIENTATION) <> 0 then if Orientation = poPortrait then FMode.dmOrientation := DMORIENT_PORTRAIT else FMode.dmOrientation := DMORIENT_LANDSCAPE; if (FMode.dmFields and DM_COPIES) <> 0 then FMode.dmCopies := 1; if ((FMode.dmFields and DM_DEFAULTSOURCE) <> 0) and ((Bin and $FFFF) <> $FFFF) then FMode.dmDefaultSource := Bin; FPrinter.SetPrinter(FDevice, FDriver, FPort, FDeviceMode); finally GlobalUnlock(FDeviceMode); end; GetSettings; end;
Обсуждают сегодня