Mega Code Archive

 
Categories / Delphi / Printing
 

Getting printer capabilities

Question: How can I detect if a printer is capable of printing graphics, large bitmaps, and DIBs? Answer: You can call the GetDeviceCaps function and test the capability against the RASTERCAPS capability. Note that if the Device does support graphics, but does not support another raster capability such as "StretchDib", Windows will handle the call by using lower level graphic primitives to accomplish the task. Example: if (GetDeviceCaps(Printer.Canvas.Handle, RASTERCAPS) and RC_NONE) = RC_NONE then NoGraphics := True; if (GetDeviceCaps(Printer.Canvas.Handle, RASTERCAPS) and RC_STRETCHDIB) = RC_STRETCHDIB then DeviceDirectly SupportsStretchDIB := True else WIndowsWillSimulateStretchDIB := True;