Please refer to the Integration Server Java API Reference guide and Service Development Help guide for how to build JAVA services in webMethods.
For file-related operations see if something helpful you can find for your requirement under the pub.file folder.
As per your requirement, you should be using the octet-stream content type while doing your logic so that it can be downloaded in the browser and printed.