I am writing virtual printer using this existing solution. I have problem with the receive data subcommand.
+----+-------+----+------+----+
| 03 | Count | SP | Name | LF |
+----+-------+----+------+----+
Command code - 3
Operand 1 - Number of bytes in data file
Operand 2 - Name of data file
Whenever I process this command, the data file size - Count - is always some weird big number - 125899906843000. I am stuck here and I cant find out why this happens. Does somebody know where should be a problem? Thanks
EDIT:
I've find where the problem is. Here is the answer for my own question. The problem is because Microsoft sends an impossibly huge number, instead of the actual size of the file in bytes. There are two ways to solve the problem:
- Edit TCP/IP port of the virtual printer and enable LRP byte counting. This forces Windows to count the number of bytes in the file and send this value in the Receive data file subcommand.
- Modify RPM so that it handles the "unknown length file" situation by receiving all data from the request to send the data file until the connection is closed by the LPR client.