[jcifs] Some printer questions

Michael B Allen mba2000 at ioplex.com
Mon Jan 15 18:07:53 GMT 2007


On Sun, 14 Jan 2007 22:52:22 -0500
"Eric Glass" <eric.glass at gmail.com> wrote:

> Mike,
> 
> I had a couple of questions around printing; I've hacked together what
> I need to work, but looking for the "best" approach.
> 
> Basically, I'm generating PostScript via Java2D and dumping that to a
> printer; I've gotten this to work by setting

Cool. I looked into doing that once but couldn't figure out how to get
the raw PostScript.

> jcifs.smb.client.useNTSmbs = false and then adding the following in
> SmbTree.java (around line 75, where it is checking the "allowable"
> commands):
> 
>     case SMB_COM_WRITE:
> 
> 
> (apparently only SMB_COM_WRITE_ANDX is currently supported, causing
> jCIFS to spit out "Invalid operation for LPT1: service" with NT SMBs
> switched off).
> 
> I guess my question is, is there any "cleaner" way to do this?  Seems
> funky to disable NT SMBs globally, and recompiling for a one-line
> change is also a pain.  Any thoughts?

I have no idea. I thought useNTSmbs was totally ignored.

Key on tree.service.equals("LPT1:") to use SMB_COM_WRITE instead and
send me a patch for The List.

Beware however, that generating valid output is likely going to be printer
specific. One one printer it might work fine but on another you may get
"stair-stepped" text or garbage. I think you can setup a shared printer
in Windows that will normalize PostScript to whatever it needs to be
for the target printer but still, printing is a potential Pandora's box.

Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/


More information about the jcifs mailing list