I am using redmon and ghostscript to create a pdf printer. The first step is to convert the document to pdf format(ghostscript can help do this). Then I need to get the print parameters(collate, color, copies .etc) when user prints. Finally I will send the pdf file and the print parameters to my server. I have redirect the port to my application.exe. Is there anyway to get the print parameters in my application?
-
Those parameters are handed to GhostScript for use in creating a PDF. How does collation and #copies mean anything in the context of non-printer output? – Steve Friedl Feb 17 '20 at 06:21
1 Answers
The values for NumCopies, Duplex, collate etc will be in the PostScript file created by Windows, in the device-specific portion of the PostScript program, and stored in the page device dictionary.
The PDF format (as implied by Steve Friedl above), does not have an equivalent means of storing parameters in the PDF file. When printing PDF such parameters are normally stored as a Job Definition FIle (JDF) or similar.
Since you can't store the values in the PDF file, Ghostscript discards them when creating a PDF.
The only way you can retrieve these values is to read the incoming PostScript program, locate the device-specific portion and parse the values out yourself. Obviously you would invoke your application to do this before then passing the PostScript file to Ghostscript for creation of a PDF file. So you would have to run your application from RedMon, and then have your application run Ghostscript.

- 30,202
- 3
- 34
- 51