Is it possible to obtain file path from IPP headers?

318 Views Asked by At

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?

1

There are 1 best solutions below

5
On

0x42 specifies just the value type - in this case it probably represents type nameWithoutLanguage.

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.

  • Jobs sent via the ipp operation 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.

  • Jobs sent via the ipp operation 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:

The "requesting-user-name" (name(MAX)) attribute SHOULD be supplied by the client as described in section 8.3.