P$
The P$ library routines allow access to printing features.
Routine
Feature
resets the Choose Printer dialog
clears font description
disables automatic Choose Printer dialog
shows the Choose Printer dialog
prints a bitmap
draws a box
draws a line
draws a rounded box
enables automatic Choose Printer dialog
retrieves device capabilities
retrieves current Choose Printer dialog fields values
retrieves current font description
retrieves characteristics of the current font
forces the next printer output to a new page.
changes default mode for positions and sizes
changes default measurement unit for positions and sizes
sets values for the Choose Printer dialog
sets the print job name
changes the current font
sets the style, width and color of the pen
sets the position for the next print operation
sets the text color
sets the position for the next print operation adjusted from the top or bottom of the current font
sets the top margin of the paper
prints text
Note - These routines are supported for RM/COBOL compatibility. In order to take advantage of every print feature provided by isCOBOL, refer to WIN$PRINTER.
Examples:
Example - Create a graphical document
       program-id. pprinter.
 
       input-output section.
       file-control.
       select print-job assign to printer spooler-name
           organization line sequential.
 
       file section.
       fd  print-job.
       01  print-record            pic x(80).
 
       working-storage section.
       copy "isgui.def".
       copy "iscrt.def".
       copy "isopensave.def"
       77  crt-status              is special-names crt status pic 9(5).
       77  hWin                    handle of window.
       77  close-win               pic 9 value 0.
       77  spooler-name            pic x(128).
                                  
       screen section.
       01  mask. 
           03 push-button
              line                 2
              col                  2
              title                "&Print"
              exception-value      101
              .
           03 push-button
              line                  2
              col                   + 2
              title                 "Pre&view"
              exception-value       102
              .
           03 push-button
              line                 2
              col                  + 2
              title                "PD&F"
              exception-value      103
              .
 
       procedure division.
       main. 
           call "c$guicfg" using "Printer Dialog Always=False"
           
           call "c$setdevelopmentmode"
 
           display independent graphical window  
                   color  65793
                   with   system menu
                   title  "P$ Routines"
                   handle hWin
                   event  win-evt
 
           display Mask   
 
           perform until crt-status = 27 or close-win = 1
             accept Mask 
                    on exception 
                       continue 
             end-accept
             evaluate crt-status
                      when 101  
                           perform normal-print
                      when 102  
                           perform print-preview 
                      when 103  
                           perform print-pdf  
             end-evaluate
           end-perform
 
           destroy mask
           destroy hwin    
           goback
           .
              
 
       print-preview.
           move "-p preview" to spooler-name
           perform print-procedure
           .
 
 
       print-pdf.
           initialize opensave-data, spooler-name.
           accept opnsav-default-dir from environment "user-path"
           move "PDF Files (*.pdf)|*.pdf" to opnsav-filters
           move "pdf"                     to opnsav-default-ext
           call "c$opensavebox" using opensave-save-box
                                      opensave-data
           if return-code < 0
              exit paragraph
           end-if
 
 
           string "-P PDF "       delimited by size
                  opnsav-filename delimited by trailing spaces
                                  into spooler-name
 
           perform print-procedure
           .
 
       normal-print.
           move "-p spooler" to spooler-name
           perform print-procedure
           .
            
 
       print-procedure.
           open output print-job
      *print of bitmap pictures
           call "p$drawbitmap" using "files/img.png"
                                     33"Absolute""Metric" 
      *print of colored strings (a red text in this case)
           call "p$settextcolor" using "Red"
           call "p$textout" using "colored string"29,
                                  "Absolute""Metric"
      *print of graphical shapes (how to create a table)
           call "p$drawbox"  using 210"Absolute""Metric"
                                  16,  5"Metric" 
           call "p$drawline" using 510"Absolute""Metric"
                                   515"Absolute""Metric" 
           call "p$drawline" using 212"Absolute""Metric"
                                  1812"Absolute""Metric" 
 
           close print-job
           .
 
 
       win-evt.
           if event-type = cmd-close
              move 1 to close-win
           end-if.