Delphi Printing Info and Links

AmazonTechnical.gif (2495 bytes)  in   look for  Delphi


TExcellent FAQ


Also see Delphi Files, Directories, Disks, I/O Page

Single Most Frequently Asked Question:
How can I print a bitmap?


Abort dialog How to Print in Windows, Borland TI 188D.  Includes AbortCallBack example.
Add Printer dialog How can I execute the Add Printer wizard?

Download efg's translation to Delphi of most of the C++ code in Microsoft's Knowledge Base Article Q153751Using Printers with Windows 95 Shell: SHPrinters.ZIP

Background Printing A TPrintThread class and example is in Chapter 5, Concurrent Programming, in Delphi in a Nutshell, pp. 103-108.
Bins Bin Selection:  Peter Below's UseNet Post about TPrinter and Bin Selection

Determine Available PaperBins with DeviceCapabilities API
http://support.microsoft.com/support/kb/articles/Q194/7/89.ASP 

Getting Bin Names from Your Printer, Borland FAQ 1455D

ChangePrinterBin:  Xavier Pacheco's UseNet Post with ChangePrinterBin procedure

Changing Paper Trays:  Peter Below's UseNet Post and suggestions

Also see DeviceCapabilities

Brush Styles What line styles and brushes are available with my printer?
See efg's Printer Demo #2

See Brush Styles on Delphi Graphics VCL/RTL page

See E-mail note from Hel Skovorodnikov about filling a print canvas area with a user-defined brush.

Color How Do I Print in Color?
Borland FAQ 2685D

Printing in color
Borland FAQ 1650D

Joe Hecht's UseNet Post with functions IsColorPrinter and SetPrinterColorMode

Non-Delphi:

WinColorKit: Windows Color Quality Test Kit for Device OEMs
www.microsoft.com/hwdev/color/ColorTest.htm 

Different Font Colors Print As Same Color
http://support.microsoft.com/support/kb/articles/Q209/8/79.ASP

Color Printer Test Page
www.fho-emden.de/~hoffmann/a3gencolortest.pdf 

Also see efg's Color and Computers page and Delphi  Graphics Color page

Components BDPrint.  Delphi 5.0 freeware component to print a full form (on screen and offscreen portions) and all components on that form.  Scan a printed form, put the TBitmap in a TImage at design time, and put necessary components such as TEdit, TCheckBox on top of the image.  At runtime, fill out the information on the screen and print the completed form.  This clever solution is by Bob Dalton, President, Digital Logistics Software Companyftp://ftp.digitallogistics.com/bdprint.zip

EDSprint component:  This component allows Delphi developers to programmatically get/set the various properties of the current printer.   www.onedomain.com/edsprint.htm

MPrtInfo.  This component let you access to Windows95/98 and NT structures containing virtually any information   provided by the system about installed printers and their  pending jobs. Structures available are: PRINTER_INFO_1, 2, 3, 4 and 5, DEVMODE, JOB_INFO_1 and 2 (see Win32 online help for  details), plus some obvious properties (installed printer names  list, selected printer name and index in the list and so on).  Methods to pause, resume and clear printers and jobs, some  printer configuration dialogs. Events to monitor printer and  printer jobs status changes.   http://delphi.icm.edu.pl/ftp/d30free/mprtinfo.zip

TAsciiPrinter is a non-visual component which gives control over   printers back to the developer, just like in DOS PRINT, but  through windows. Ideal for DOT MATRIX printers, as text is  printed as ASCII, rather than a graphic.  http://delphi.icm.edu.pl/ftp/d10share/asciprnt.zip

TDBPrinterSetupDialog is a TPrinterSetupDialog component with capability of getting/setting printersetup-values (orientation, papersize etc) at designtime and runtime.
http://delphi.icm.edu.pl/ftp/d20free/pbprints.zip 

List of Printer-Related Components
www.programmersheaven.com/zone2/cat68/index.htm 

Default Printer Peter Below's UseNet Post about changing default printer in D6 

How to get the default printer name
http://community.borland.com/article/0,1410,28000,00.html 

Changing Windows Default Printer in Code.   Borland FAQ 2618D.   This Borland example is very weak.  While accurate, the example is incomplete when it does not show how to form the string needed in the WinIni.WriteString call. FAQ 1109D, Getting the Printer driver and port name from TPrinter's, does give the needed clue but doesn't provide all the needed details.

For a complete D3/D4 example of how to change the Windows 95/98 default printer -- WITH persistence -- see PrinterDefault.ZIP.

Peter Below's UseNet Post about Programmatically Changing the Default Printer.

"Win32 error. Code123." when no Default Printer exists
UseNet Posts by Sergei Soudakov and Paul Ferrara

Change the default printer in MS Windows 
www.scalabium.com/faq/dct0032.htm 

"Changing the Default Printer," Delphi 5 Developer's Guide by Teixeira and Pacheco in Online "CD" Chapters, pp. 189-190

Printing to another printer than the default one, Borland FAQ 2984D

No Default Printer Selected Error Message, Borland FAQ 2386 D

Device Independence  How can I draw something (images, lines, etc.) on a screen canvas and then print exactly the same thing on the printer?  In general, a printer has many more pixels than your video monitor. Sometimes you can just dump the screen's contents to the printer (which is possible), but normally you'll want to draw your images or lines directly on the printer's canvas to take advantage of its higher resolution. See efg's Printer Demo #2 for an example of how to do this.
DeviceCapabilities Alex Weidauer's UseNet Post with example of listing printer device capabilities

Mihai Nicolae Teognoste's UseNet Post with WinSpool.DeviceCapabilities example for DC_ENUMRESOLUTIONS

Calling ExtDeviceMode/DeviceCapabilities in Win32s App
http://support.microsoft.com/support/kb/articles/Q132/2/39.asp 

The DeviceCapabilities function retrieves the capabilities of a printer device driver.
DC_BINADJUST, DC_BINNAMES, DC_BINS, DC_COLLATE, DC_COLORDEVICE, DC_COPIES, DC_DRIVER, DC_DATATYPE_PRODUCED, DC_DUPLEX, DC_EMF_COMPLIANT, DC_ENUMRESOLUTIONS, DC_EXTRA, DC_FIELDS, DEC_FILEDEPENDENCDIES, DC_MANUFACTURER, DC_MAXEXTENT, DC_MEDIAREADY, DC_MINEXTENT, DC_MODEL, DC_ORIENTATION, DC_NUP, DC_PAPERNAMES, DC_PAPERS, DC_PAPERSIZE, DC_PERSONALITY, DC_PRINTERMEM, DC_PRINTRATE, DC_PRINTRATEPPM, DC_PRINTRATEUNIT, DC_SIZE, DC_STAPLE, DC_TRUETYPE, DC_VERSION
http://msdn.microsoft.com/library/psdk/gdi/prntspol_21bn.htm 

DeviceCapabilities Function Sample Code
http://support.microsoft.com/support/kb/articles/Q81/2/45.ASP 

Determine Available PaperBins with DeviceCapabilities API
http://support.microsoft.com/support/kb/articles/Q194/7/89.ASP 

Also see Bins, DEVMODE, GetDeviceCaps

DEVMODE Peter Below's UseNet Post with example

DEVMODE Structure
http://msdn.microsoft.com/library/psdk/gdi/prntspol_8nle.htm 

Draft Mode Woody's UseNet Post about selecting draft mode using the device mode commands
Drivers Getting the Printer driver and port name from TPrinter's, Borland  FAQ 1109D

Programmatically Installing Printer Driver, Borland FAQ 1361D

Imager SDK, a suite of OEM fax software components (SDK toolkit) offers client and server solutions for Windows 95/98/ME/NT/2000, including Imager Print Drivers.  www.meta-soft.com 

Print to graphics file format using special printer driver:  PEERNET.DRV Pro Driver
www.peernet.com/drivers/C._PRO_Driver.html   File Formats Supported

Virtual printer for Windows 95/98 that, instead of printing on paper, transforms documents in standard files (BMP, TIF, PCX, DCX and TXT).
www.eurosistemi.it/uk_vpd.htm

Virtual Printer works like a common printer - but you don't get any printout! It gives you the whole printout as a collection of Enhanced Metafiles that you can view (and print) with the EMF-Viewer.
www.mabuse.de/noframe/vprinter.html 

Envelopes Printing Envelopes in  Delphi 5 Developer's Guide by Teixeira and Pacheco, pp. 166-183 (on the CD)
Errors Detecting Print Errors, Borland FAQ 1762D
No Default Printer Selected Error Message, Borland FAQ 2386 D

"Printing in Progress" Error.  Do not try to reset the Printer.Orientation after a Printer.BeginDoc has been issued.  The Printer Orientation should be set before calling Printer.BeginDoc.

See Error Codes page

Floodfill UseNet Post with responses to "How can I use FloodFill on Printer.Canvas?".  Steve Schafer:  "Not all GDI devices support FloodFill. Printers are especially   unlikely to support it."  Joe Hecht:  "the reason is there is often no frame buffer used for a printer. FloodFilling against pixels already printed is kinda difficult"
Fonts The size of my text characters changes on different printers -- OK on some printers and very small on other printers. How can I set the font size to be the same physical size on different printers?
The best way to fix a bug in TPrinter:
Assuring Proper Font Scaling When Printing,
TI 1547D
[Thanks to Joe Hecht for this information.]

Set the Height in a device-independent way and never use the font.size.
Printer.Canvas.Font.Height :=
   MulDiv(GetDeviceCaps(Printer.Canvas.Handle,
                        LOGPIXELSY), FontSize, 72);
[Thanks to Jeff Wormsley for this concise statement.]

Use a resident font for printing?  www.scalabium.com/faq/dct0068.htm 

How to use the default resident font in the printer, Borland FAQ 1133D

How can I print using a rotated font?  Assuming the printer supports rotating fonts, and the font is a TrueType or other rotatable font, see Joe Hecht's solution.

Different Font Colors Print As Same Color
http://support.microsoft.com/support/kb/articles/Q209/8/79.ASP

Generic/Text Printer Peter Below's UseNet Post with PrintLineToGeneric procedure to print a line to the generic/text printer without formfeed 
GetDeviceCaps Getting Printer Capabilities (printing graphics, large bitmaps, DIBs), Borland FAQ 1475D

How can I determine my printer's resolution?
For pixels/inch, use the GetDeviceCaps API call with a LOGPIXELSX or LOGPIXELSY parameter. You might also find Printer.Canvas.Font.PixelsPerInch useful.

For total pixels in the horizontal or vertical dimension, use Printer.PageWidth, Printer.PageHeight or GetDeviceCaps with HORZRES or VERTES parameters.

What other useful information can I get using the GetDeviceCaps API call?
Horizontal size (HORZSIZE) or vertical size (VERTSIZE) in millimeters, bits/pixel (BITSPIXEL), color planes (PLANES), various capabilities (e.g., CURVECAPS, LINECAPS, POLYGONALCAPS, TEXTCAPS, CLIPCAPS, RASTERCAPS, SHADEBLENDCAPS), aspect ratio (ASPECTX, ASPECTY, ASPECTXY), physical page size (PHYSICALWIDTH, PHYSICALHEIGHT), printable area offset (PHYSICALOFFSETX, PHYSICALOFFSETY).

These values and others are printed by efg's Printer Demo #1.

"GetDeviceCaps and DeviceCapabilities," Delphi 5 Developer's Guide by Teixeira and Pacheco in Online "CD" Chapters, pp. 191-207

Passing TPrinter handle to GetDeviceCaps in Borland FAQ 2610D

Also see DeviceCapabilities

GetPrinter / SetPrinter ChangePrinter:  Stephen Brown's UseNet Post with ChangePrinter procedure

Changing the Printer Port in Code, Borland FAQ 2921D

Changing the Papersize of a Print Job, Borland FAQ 603D

See Reset below.

Installed Printers Finn Tolderlund's UseNet Post with AnyPrintersInstalled routine

MPrtInfo.  This component let you access to Windows95/98 and NT structures containing virtually any information   provided by the system about installed printers and their  pending jobs. Structures available are: PRINTER_INFO_1, 2, 3, 4 and 5, DEVMODE, JOB_INFO_1 and 2 (see Win32 online help for  details), plus some obvious properties (installed printer names  list, selected printer name and index in the list and so on).  Methods to pause, resume and clear printers and jobs, some  printer configuration dialogs. Events to monitor printer and  printer jobs status changes.   http://delphi.icm.edu.pl/ftp/d30free/mprtinfo.zip

List of Printers EnumPrinters.  API call to enumerate available printers, print servers, domains, or print providers.
Margins Marginal Printing.  Your printer knows its own limitations -- all you have to do is ask.
March/April 1999, Visual Developer, pp. 96-97

Getting the Printing Margin of the Page, Borland FAQ 1115D

NT Tips Jeff Hamblin's UseNet Post with solution for some NT printing problems.

Direct Commands to Printer -- Passthrough/Escape, Borland  TI 1497D

See EnumPrinterData under Printer Properties

Online Checking if Printer is Online
Peter Below's UseNet Post showing how to capture WMSpoolerStatus messages.
Peter Below's UseNet Post about checking whether printer is "on".
Peter Below's UseNet Post about EnumJobs for printer status in WinNT.

Detecting Printer Status, www.undu.com/Articles/990228a.html

Testing Printer Status:  Chris' UseNet Post

Q160129:  HOWTO Get the Status of a Printer and a Print Job
http://support.microsoft.com/support/kb/articles/Q160/1/29.asp

Orientation How can I tell what direction a printer will rotate output on a landscape page?
See Joe Hecht's UseNet Post

Detecting what direction a printer will rotate for a portrait, Borland FAQ 902D

Packages StatPlot -- TP 4 or later plotting software for HP LaserJet 2 or later
StatUnit at www.math.ku.dk/ims/software/index.html
TExcellent FormPrinter
  • Prints Delphi forms reliably to most any graphics capable printing device.
  • Allows you to print your complete form (even the portions that are scrolled out of view)!
  • Allows you to print your form to any size, even enlarged to span across multiple pages (up to 2 billion pixels high and wide). The multi page capability is excellent for creating presentations, enginering drawings, and even billboards!
  • Allows you to print forms that are hidden from view (by opening the form off the screen).

by Joe C. Hecht.  www.code4sale.com/joehecht/prnform.htm 

TExcellent ImagePrinter

  • Prints Windows device independent bitmaps *reliably* to most any graphics capable printing device.
  • Allows you to print your image to any size, even enlarged to span across multiple pages (up to 2 billion pixels high and wide). The multi page capability is excellent for creating presentations, engineering drawings, and even billboards!
  • Handles all Windows bitmap formats.
  • Can work with bitmaps up to 2 billion pixels high and wide.
  • FAST (as reliably possible) with a very small memory footprint.

by Joe C. Hecht.  www.code4sale.com/joehecht/prndib.htm 

GmPrintSuite Professional is a set of print/print preview components which provide...
- Full page preview with zooming & page panning
- Page Thumbnails component
- String grid printing
- RichEdit, RichEdit98 and RxRichEdit with embedded graphics support
- Portrait and Landscape pages in the same report
- Multipage and Duplex printing
- Includes Rotated text & TextBox functionallity
- TTreeView printing
- Avery label printing
www.murtsoft.com/Downloads/GmPrintSuite/GmPrintSuite_2_54_Lite.exe

Paper Bins See Bins
Paper Names Paper Formats for Default Printer
www.gnomehome.demon.nl/uddf/pages/printer.htm#printer12

OFF: Macro to Obtain a List of Paper Names Supported by the Active Printer
http://support.microsoft.com/support/kb/articles/Q229/7/18.ASP 

Paper Size Changing the Papersize of a Print Job, Borland FAQ 603D

Peter Below's UseNet Post about setting printer paper size.
Peter Below's UseNet Post with example of changing DEVMODE when new page printer form added.

Also see TDeviceMode.

Pen Styles What line styles and brushes are available with my printer?
See efg's Printer Demo #2

Line Styles and Colors.  Steve Schafer's  (Team B) UseNet Post:  "GDI drivers are not required to support line styles other than psSolid and psClear if the line width is anything more than 1 pixel. Some drivers do support wide styled lines, but most do not. The only sure-fire fix that I know of is to draw all of the dashes and dots yourself."

Postscript Determining if a given printer is capable of printing a PostScript file
Borland FAQ 914D
Print Preview Print preview of TRichEdit, www.howtodothings.com/showarticle.asp?article=432 

Greatis Print Suite.  Components for Print and Preview. An extremely convenient set of components which provides advanced print and preview features into Delphi and C++ Builder applications.    http://www.greatis.com/printsuite.htm 

In an E-mail, Adirano Urbano suggests using Quick Reports for a print preview (19 Jan 2001).  For example:

QRPrinter.Title := 'Example'
QRPrinter.BeginDoc;
QRPrinter.Canvas.TextOut('put your code here');
QRPrinter.EndDoc;
QRPrinter.PreviewModal;

GmPrintSuite is collection of 6 components based around the GmPreview print preview component. 
www.murtsoft.com/Downloads/GmPrintSuite/GmPrintSuite_2_54_Lite.exe

Add Print Preview to Your Applications
www.undu.com/Articles/000207f.html

SPRINT:  Print & Preview Engine for Delphi. It has never been easier to create multi-column multi-grouped reports with FULL control of every little printer pixel.
http://delphi.icm.edu.pl/ftp/d40share/Sprint11.zip 

Component by Ben Ziegler
www.radix.net/~bziegler/Delphi/pprev.zip
(Requires "Ben's Library")

PrintDrv.  Print preview component that allows you to code your own reports without the need for visual report writers or complicated printer calculations. This component wraps the device-independent methods used to ensure good print outs regardless of printer and provides a scalable preview form allowing users to preview any report before printing.   http://delphi.icm.edu.pl/ftp/d20free/printdrv.zip

Print/preview the MS Access's report, www.scalabium.com/faq/dct0083.htm 

Printer Queue How can I show the Printer Queue?  Download efg's translation to Delphi of most of the C++ code in Microsoft's Knowledge Base Article Q153751,Using Printers with Windows 95 Shell: SHPrinters.ZIP
Printer Properties How can I display the Windows 95 Printer Properties dialog?  Download efg's translation to Delphi of most of the C++ code in Microsoft's Knowledge Base Article Q153751Using Printers with Windows 95 Shell: SHPrinters.ZIP

EDSprint component:  This component allows Delphi developers to programmatically get/set the various properties of the current printer.   www.onedomain.com/edsprint.htm

Property changes in same print
http://www.gnomehome.demon.nl/uddf/pages/printer.htm#printer11
 

EnumPrinterData.  API call to enumerate configuration data for a specified printer.  (New in Windows NT).  From the Win32 Developer's References:  "A printer's configuration data consists of a set of named and typed values. The EnumPrinterData function obtains one of these values, and its name and a type code, each time you call it. Call the EnumPrinterData function several times in succession to obtain all of a printer's configuration data values. Printer configuration data is stored in the registry. While enumerating printer configuration data, you should avoid calling registry functions that might change that data."

Printer Settings / Setup How can I get a printer's settings?
www.scalabium.com/faq/dct0019.htm 

How can I set a printer settings?
www.scalabium.com/faq/dct0020.htm 

TPrinterSetupDialog.  This non-visual Delphi component that can be used to change the default Windows printer, but it does not provide persistence for the next time a program is run.

TPBPrinterSetupDialog is a TPrinterSetupDialog component with capability of getting/setting printer setup values (orientation,  paper size, etc.) at design time and runtime. Settings can be saved so users don't have to setup the printer every time they run  your program.
http://delphi.icm.edu.pl/ftp/d20free/PBPrintS.zip 

How can I read a printer settings - page sizes and margins?
http://www.scalabium.com/faq/dct0017.htm 

Changing the Printer Setup between Printed Pages
Borland FAQ 1545D and Joe Hecht's UseNet Post

Borland's FAQ 2618D and FAQ 1109D give clues about how to implement persistence for Windows 95/98, but are missing details and do not provide a complete example.

For a complete D3/D4 example of how to change the Windows 95/98 default printer -- WITH persistence -- see PrinterDefault.ZIP.

Printers I'm not getting the same printouts on different printers. What am I doing wrong?  Getting the "same" printout on a wide variety of Windows printers is almost impossible.   See efg's Printer Demo #1.

HP Printers
Steve Philipp's (Heuristic Research) Report About Problems with HP Printers and Drivers

Printing graphics to a HP LaserJet (using HP PCL), Borland TI 71D (D1 only?)

Epson Printers.  E-mail comments from Armindo Da Silva:  "I have noticed a few weeks ago that if you don't set printer.title, you won't be able to print on Epson Stylus Color x60 series....  Another bug is that if you use the ICC mode with big pictures you will get false color compared to small pictures."  Try getting the latest printer drivers to solve these problems.

Printing Graphics to an Epson Compatible, Borland TI 80D (D1 only)

Printers, Multiple Simultaneously Printing to Multiple Printers, Borland FAQ 1367D
Printers Unit www.doit.com/delphi/undu/dn0524i.htm
Printing Bitmaps How can I print a bitmap?

1.  A good and "free" method.  Use the StretchDIBits API call.  (Make sure you have a DIB by setting PixelFormat to pf24bit, or setting HandleType to bmDIB.)
Look at the StretchDIBits code fragment example. 
Complete Delphi D3-D5 Project.   D1 Solution.   Builder C++ Example.

See Rodney E. Geraghty's UseNet Post about "How do I print a bitmap?" with code for D1/D2/D3

How to print a JPEG displayed in a TImage
How to print a GIF displayed in a TImage

efg's UseNet Post explaining how to print a TPanel object

Chris Rorden's version of how to print a JPEG with these improvements:
1.) checks whether the image is taller or wider, and selects landscape or portrait to suit.
2.) checks the image aspect ratio versus the printer aspect ratio, to see whether height or width is the constraint on scaling.

Why is StretchDIBits necessary?
See Blitting Between DCs for Different Devices Is Unsupported (MS Q195830)

IF   (GetDeviceCaps(Printer.Canvas.Handle, RASTERCAPS) AND
      RC_STRETCHDIB) = RC_STRETCHDIB
THEN
<printer directly supports the StretchDIBits>
ELSE
<Windows will simulate StretchDIBits>;

Joe C. Hecht's 14 May 99 comments from UseNet Post to borland.public.codecentral:   "The only way to print an image (form or otherwise) reliably is to use StretchDIBits(). You are much better off not calling GetDIBits() to get the image bits, as the palette is often neglected in the process. The best thing to do is to manufacture a really good DIB header and color table. If the image is coming from a res file, disk file, or other *reliable* DIB source, then the job is easy, providing you do not mind retrieving the DIB directly from the source, with no VCL code sitting in between you and the image. Note that building a *good* bitmap reader is not exactly easy (as evidenced in the VCL).

"Getting a good color table from a screen image is more difficult, since you must take into account the correct palette should the device be a palette device. That includes 1, 4, and 8 bit images, as they all have a color table. Finally, should the printer be a palette device (rare), you must make a palette available to the printer. Under NT, just about every printer has at least palette structure under the hood (even if it is internally bypassed) (not that that info is actually valuable here)."

Which VCL methods can I use while printing images?  Any the VCL methods for drawing raster images should never be used to a printer.  Problems  are caused by sending a bitmap based on another device to the printer (and you should never do that).  Joe Hecht  pioneered the workaround for this problem at driver level.  Some drivers are now able to detect this error and work around it, but you cannot rely on all drivers to do this.  The damage that can be done includes bringing down the entire NT system!  [Thanks to Joe Hecht for E-mailing me this information. 19 Jan 99]

See efg's Printer Demo #1 for a complete example and a comparison of using Draw and StretchDraw instead of StretchDIBits. (You're very lucky if Draw and StretchDraw work for you!)

Delphi 4/5 Books are still WRONG about printing bitmaps

Mastering Delphi 5 by Marco Cantý still incorrectly shows to use Printer.Canvas.StretchDraw on p. 867 to print a bitmap.  I sent an E-mail to Marco and he says this will be shown in the "bug list" and corrected in future editions.

"Printing a Bitmap" in Delphi 5 Developer's Guide by Teixeira and Pacheco in Online "CD" Chapters, p.158, still incorrectly shows to use StretchDraw.  I sent an E-mail to the publisher and the authors about this issue.

2.  "Better" free method.  Use StretchDIBits but don't ignore palettes (which may be needed on some printers).  A Better Way to Print A Form (by Joe Hecht), Borland's  TI 1412D.

3.  Best method (but not free).  See links to Joe Hecht's TExcellent products (below)

ORLFaces.jpg (24320 bytes) 
Print Matrix of images on a single page.  See efg's Slide Show Lab Report
Printing Files College Student Guide to Reading and Writing Files, Borland TI 641D

Printing to a File, Borland FAQ 2394D

Printing Graphics To print a graphics file, convert to a TBitmap and use StretchDIBits.  See Printing Bitmap 

How can I print a TMetaFile to the printer?  UseNet Post by Mat Ballard

Sending an Image to the Printer.  Borland FAQ 1211D (Formerly Q&A 821)  There is a missing "NOT" in the second sentence, but I can't get anyone at Borland to fix this.  The statement should read  "This means you should NOT use the VCL canvas methods Draw, StretchDraw,CopyRect, BrushCopy, and the like to transfer a bitmap to the printer."

Better Way to Print A Form, Borland  TI 1412D

Interesting approach:
www.drdelphi.com/delphi/right/tips/printform.htm

PrintScreen See Screen Capture
"Raw" printer access RawPrint.  Delphi unit that allows sending raw data, including control characters, to a Windows printer.  The data is sent to the printer in the approved Windows manner, as opposed to opening the LPT port and writing directly to it.   (Writing directly to the LPT port will not work under Windows NT or future Windows versions.)  32-bit only.  www.pcisys.net/~robr/download.htm

Writing a Raw String of Data to the Printer, Borland FAQ 651D

Joe Hecht's PrtRaw.PAS demonstrates a 16/32 bit
raw printing unit for Delphi and Borland C Builder.

TDxPrinter.  Send data directly to any windows printer
http://tothpaul.free.fr/zip/DXPRINT.ZIP 

Printing Raw Data
www.undu.com/DN970301/00000067.htm

Printing Directly to a Printer, www.undu.com/DN970101/00000008.htm
Can I use the AssignPrn method to write directly to a port?, Borland FAQ 1061 D

Escape function

How to Print in Windows, Borland TI 188D

Peter Below's UseNet Post showing how to print to HP LaserJet

Direct Commands to Printer -- Passthrough/Escape, Borland  TI 1497D

Send command strings to printer
www.scalabium.com/faq/dct0087.htm 

Determining if a given printer is capable of printing a PostScript file
Borland FAQ 914D

Reports Delphi Report Builder Components
http://digital-metaphors.com/subpages/reportbuilder/main_delphi_components.html

Printing Reports Using Word
www.undu.com/Articles/990212b.html

Printing Delphi controls using Quick Reports
Borland FAQ 2976D

Printing a footer on only the last page of a report, Borland FAQ 2994D

I have relatively modest printing requirements. The various report writers seem like overkill. How can I print fairly simple reports directly in Delphi?

Formatting and Printing Output for the Printer
www.borland.com/devsupport/delphi/devcorner/techtips/printform.html

HardCopy example on efg's Printer Projects Page

Reset ResetPrinter.  borland.public.delphi.winapi post by Peter Below (23 March 2000):
The Printer object sometimes needs to be kicked to correctly load the selected printers device context:

// call this procedure before the BeginDoc
procedure ResetPrinter;
  var
    Device, Driver, Port: array[0..80] of Char;
    DevMode: THandle;
begin
  Printer.GetPrinter(Device, Driver, Port, DevMode);
  Printer.SetPrinter(Device, Driver, Port, 0)
end;
ResetTPrinter.  Nick Ryan's UseNet Post for correcting some weird bug in Delphi's TPrinter that causes information to be retained from a previous print session (D3)
Screen Capture

Links about Screen Capture involving printing
Runtime Keystrokes links about Screen Capture

Print a bitmap snapshop of virtual form than can be larger than client area
John Reynolds UseNet Post

Delphi 5.0 freeware component to print a full form (on screen and offscreen portions) and all components on that form.  Scan a printed form, put the TBitmap in a TImage at design time, and put necessary components such as TEdit, TCheckBox on top of the image.  At runtime, fill out the information on the screen and print the completed form.  This clever solution was contributed by Bob Dalton, President, Digital Logistics Software Company.
Complete D5 Source Code and Example:  BDPrint.ZIP

Shades of gray See efg's Printer Demo #2

Postscript:   This topic may need more research.  While Printer Demo #2 shows shades of gray on many printers, slight color hues appear on at least one printers, Epson Color Stylus 850.

Shapes Printing Shapes, pp. 14-16, Chapter 22 of  Mastering Delphi 5 by Marco Cantý.
Spooler Detecting How Many Jobs are in the Print Spooler, Borland FAQ 1727D

Adding PRN file directly to Spooler in Windows
Karsten Saunte's UseNet Post

WM_SPOOLERSTATUS.  Windows message sent whenever a job is added or removed from the print queue.  (but not in Windows 2000).  See UseNetPost by Finn Tolderlund.

Checking if Printer is Online
Peter Below's UseNet Post showing how to capture WMSpoolerStatus messages.

List of jobs in the MS Windows print spooler 
www.scalabium.com/faq/dct0047.htm 

Windows 95/98 Limiations withPrinting and Print Spooler
http://msdn.microsoft.com/library/psdk/win95/chilimit_8wit.htm 

Status See Online
Stop Print Jobs Peter Below's UseNet Post with suggestion about how to stop all print jobs and delete them
StringGrid / TDBGrid

How do I Print a TStringGrid / TDBGrid?  Borland FAQ 2681D
www.gw.ro/pascal/PrintStringGrid.html 

TDeviceMode "The TDeviceMode Structure" in Delphi 5 Developer's Guide by Teixeira and Pacheco, pp. 182-189 (on the CD)

Also see DEVMODE

Tips Printer: Unofficial Delphi Developers FAQ
www.gnomehome.demon.nl/uddf/pages/printer.htm

Delphi Companion: Printing
www.xs4all.nl/~dgb/delreprt.html

Printing in Delphi 5.  Delphi 5 Developer's Guide by Teixeira and Pacheco in Online "CD" Chapters, pp. 154-207

Printing/Printer SWAG (Software Archive Group):  56 examples
www.gdsoft.com/swag/printing.zip (Requires Reader)

Using Printers with Windows 95 Shell.  SHPrinters.ZIP
(efg's translation to Delphi of most of the C++ code in Microsoft's Knowledge Base Article Q1537
TListBox Printing the Contents of a TMemo or TListBox, Borland TI 785D
TMemo Printing the Contents of a TMemo or TListBox, Borland TI 785D
TPanel efg's UseNet Post explaining how to print a TPanel object
TPrintDialog Setting the MaxPage property of the PrintDialog component.  Borland FAQ 936D
TPrinter Using an instance of TPrinter, Borland FAQ 2052D
Setting the Pixels Per Inch Property of TPrinter,  Borland TI 1517D
Printing in Delphi without using the TPrinter Unit, Borland FAQ 1139D
Transparency How can I use transparency while printing?  Transparency on printers is not guaranteed.   In fact, many do not correctly support anything but SRCCOPY, BLACKNESS, and WHITENESS for ROP codes  (Postscript printers especially).  The concept of ROP'ing bitmaps on the printer is an invalid concept anyway. You simply cannot ROP on something that's already printed.  If it does work on a given driver, it is because the driver holds back the raster buffer for an entire page.  You simply cannot count on that across the board.  If you need transparency, you should do the work up front (combining images as needed), then send the image to the printer (as a DIB).  [Thanks to Joe Hecht for E-mailing me this information. 19 Jan 99]
Trays See Bins
TRichEdit

TRichEdit Printing in Delphi 2 & Windows NT 4.0, Borland TI 1532D

TStringGrid How do I Print a TStringGrid / TDBGrid?  Borland FAQ 2681D
TTreeview Peter Below's UseNet Post about how to print a treeview
TWIP Peter Below's (Team B) 7 Oct 99 UseNet Post:
"A twip is 1/20 of a point or 1/1440 of an inch.  These units come from the typesetters trade as far as I know, they predate the computer age by quite some time."
Utilities Garbo Shareware Library
http://garbo.uwasa.fi/pc/printer.html
http://garbo.uwasa.fi/windows/printer.html
Web Browser How to print an HTML document from inside of your application
http://community.borland.com/article/0,1410,26402,00.html 
Windows Limitations Printing and Print Spooler
http://msdn.microsoft.com/library/psdk/win95/chilimit_8wit.htm 
WM_PRINT Window Contents Capturing using WM_PRINT Message
www.fengyuan.com/article/wmprint.html 

Links Verified 29 Oct 2000
Updated 10 Jun 2003


since 1 Nov 1998