Skip to Content

How to programmatically set the attributes for PDFs?

Estimated Reading Time: 1 Minutes

In the 2016 R1 release, isCOBOL added the ability to configure attributes of a program-generated PDF file.
To set the default attributes for PDF prints in your programs, use the configuration variables that start with "iscobol.print.attribute".
For example, to set the author and encryption level of PDFs:

   iscobol.print.attribute.author=GTStone
   iscobol.print.attribute.encryption=258
You can also set the attributes for individual PDFs, overwriting the environment variable with the WIN$PRINTER op-code "WINPRINT-SET-ATTRIBUTE".
For example, this code snippet sets the subject and jpeg compression level of the next PDF to be printed:
  call "win$printer" using winprint-set-attribute 
                           "subject"
                           ws-subject-date
  call "win$printer" using winprint-set-attribute 
                           "jpeg"
                           50

How to programmatically set the attributes for PDFs?