[jcifs] Sending data to printer using jCIFS
Naveen Maheshwari
naveenmah at gmail.com
Wed Mar 2 04:32:59 MST 2011
Hi!
This questions has been asked many times but i could not find any reply
anywhere
I want to send raw data lets say a pcl file to a shared printer on windows.
When I do SmbFile[] files = file.listFiles();
I discover my printer properly, there is no issue
To send the data to the printer i am doing this
byte[] buf = new byte[1024];
//test.prn is just any prn file.
String root = "d:\\test.prn";
FileInputStream fin = new FileInputStream(new File(root));
// Always get exception here Parameter incorrect
SmbFileOutputStream fos = new SmbFileOutputStream(printer);
int len;
while ((len = fin.read(buf)) > 0){
fos.write(buf,0,len);
}
fin.close();
fos.close();
where printer is the smbfile of printer i got from listFiles();
I always get exception at parameter incorrect
at SmbFileOutputStream(printer) .
If instead of SmbFileOutputStream() i use
FileOutputStream fos = new FileOutputStream(\\\\10.88.183.236\\myPrinter);
PrintStream ps = new PrintStream(fos);
it works fine on windows machine , but i can not use this as I need to print
from android.
Pls. advice what I am doing wrong?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110302/e8e42bc6/attachment.html>
More information about the jCIFS
mailing list