Hi,
We've got a fairly urgent deadline (today) and have just discovered a major
error that was introduced when we hired a software contractor. The
specification for the print routine in question was that it would autoscale
to match the printer resolution. Part of the code does do this and ... yes
... part doesn't ! ... and we've ended up with code that expects the printer
to have a resolution of 300dpi.
Now ... as a temporary solution ... is it safe to force the printer into
300dpi ? (I presume that most printers will support this resolution ?).
I came across the following code (modified slightly) ... (any idea why
Printer.PrinterIndex := Printer.PrinterIndex is there ?) ... and any
comments ?
(Ever had one of those days ? ... Need to get this out today ... all our
workstation printers are DeskJets (300dpi) and the office laser has just
failed ... so can't even test it on site !)
Andrew
procedure Set300DPI;
var
PrintDevice : array [0..255] of char;
PrintDriver : array [0..255] of char;
PrintPort : array [0..255] of char;
hDevMode : THandle;
pDevMode : PDeviceMode;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(PrintDevice, PrintDriver, PrintPort, hDevMode);
if (hDevMode <> 0) then begin
pDevMode := GlobalLock(hDevMode);
if (pDevMode <> nil) then begin
pDevMode^.dmPrintQuality := 300;
pDevMode^.dmFields := pDevMode^.dmFields or DM_PRINTQUALITY;
GlobalUnlock(hDevMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end; {Set300DPI}