In DP4 the APIS for printing information are used for far more than just printing to a printer: they are often used for creating files - for example the DP4 ReportWriter uses the printing APIS to create "export files" used to send data to mainframes or other remote systems. DP4 OSDIs, used to control special hardware such as POS (Point of Service) devices like cash drawers,customer displays and receipt printers are controlled using the DP4 print APIs as well.
The DP4 printing APIs are generally similar to the APIs used to display information on screen, and use maps created in exactly the same way, using MAPEDIT or MAPPOST. Maps are often called forms in the context of printing.
To use the DP4 printing APIs a program has to open an output device (with dvc_choose() or dvc_open()), which establishes one or more destinations for your output and creates a buffer for formatting the output. Then the program formats data in the print using the print APIs (form() to output a map, and prn_x() to print fields in the form), and periodically outputs the buffer to the output device(s) with the prn_print() function. Finally the program releases the print device with dvc_close().
More information on each stage of printing is contained in the following topics: