Read the options for the pcl3 Ghostscript filter. The command line I am using for an OfficeJet 8720 looks like this:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pcl3 -sSubdevice=unspec -sColourModel=CMYK -r600 -sPrintQuality=0 -dRasterGraphicsQuality=2 -dSendNULs=600 -sIntensityRendering=halftones -dOnlyCRD=true -sOutputFile=output.pcl inputfile.pdf
You can then send the resulting file to the printer with:
nc -w 1 <printer IP address> 9100
This completely bypasses CUPS or any other spooler, so its possible to do this programmatically without spooling, assuming the system has Ghostscript and netcat. I have not yet solved the problem of page margins and offsets, the pcl3 filter also has a -sMediaConfigurationFile
option, but you must construct the content of that file specific to your printer.