printingpostscriptprinter-control-language

Determine if received data is PostScript or PCL


I have a service that receives printer data via tcp/ip. When the data is received, is there reliable, efficient way to examine the data stream and determine if the data is PostScript vs PCL data? For example, are there characters I could look for at the beginning of the data stream to indicate the format?


Solution

  • Postscript data must begin with "%!ps" or "%!PS" - it may be a longer readable string like "%!PS-Adobe-3.0" - but that is basically this.

    Most likely PCL have a similar signature - I remember seeing it in the past.