use the UDF... even for testing purposes.
Then verify the printer is connected
delete the printer and map it again with the UDF

If that works, then it is your code.

If it doesn't, then it could be the rest of your code, permissions to the machine or the printer, printer drivers available on the server, etc.
_________________________
How to ask questions the smart way <-----------> Before you ask