Problem while Printing through Networkwork Printer using JCIFS

Michael B Allen ioplex at
Wed Apr 30 15:30:04 GMT 2008

On 4/30/08, Thiyagu Venkatesan <v.thiyagu.mca at> wrote:
> Hi All,
>  I have a problem while printing through Network Printer using JCIFS
>  OS :Windows
>  Printer : HPLaser
>  The problem is
>  1. I can able to find the available network printer.
>  2. I gotted the SmbFile object for the specific Network Printer.
>  3. When I try to do the following piece of code
> fos=file.getOutputStream();  //where file is object of
>  SmbFile.....i.e shared network printer
> ps=new;
>   ps.print("God is Great");
>   ps.print("\n");
>   ps.print("ALL THE BEST");
>   ps.close();
>   System.out.println("File Writed");
>   Im getting the following error
>  The parameter is incorrect.

Hi Thiyagu,

You cannot print to a printer device with raw data like you are doing.
And for that reason, JCIFS does not even open printer devices with the
right parameters. I think it would be trivial to fix the "parameter is
incorrect" error but, again, the printer device will almost never
accept raw data like that and Java does not expose the necessary code
to generate the right input and therefore JCIFS does not support
printing in any form.

If you have any further questions, please send your messages to the
JCIFS mailing list instead. This list is about a CIFS server written
in C whereas JCIFS is a CIFS client written in Java.


Michael B Allen
PHP Active Directory SPNEGO SSO

More information about the samba-technical mailing list