I writeing printing web application which simulate printer behavior. It uses IPP protocol to receive document within printing request. I can obtain some information about print job from IPP attribute code 0x42 in IPP headers:
- filename - full file path (it's my aim) in case of Notepad++ and only filename if I print document from MS Word
- user name - from OS
Can I obtain full file path from IPP independent from application? May be I can achieve this with additional request?
0x42
specifies just the value type - in this case it probably represents typenameWithoutLanguage
.Filename
Short answer: There is no standard way to obtain the file path from ipp headers.
Depending on the ipp client implementation (e.g. the windows printer driver) you might be able to use some other attributes. There are various options how a driver could submit a print job.
PRINT_JOB (0x0002)
The file is being added as stream of bytes (formatted in a specific print-job-language like postscript or pdf) . Most implementations set the job attribute
job-name
to the name of the original filename or filepath.PRINT_URI (0x0003)
This method is rarely used but would provide a URI where the printer would have to load the file or data to print from. The URI includes a path.
Username
As for the username there is a standard ipp attribute available:
requesting-user-name
. It is the ipp clients (e.g. windows printer driver) responsibility to set the this value. RFC 2911 Section 3.2.1.1 Print-Job-Request says: