Wednesday, December 30, 2009

Java and IBM 6400 Line Feeds

I've got a client with several IBM 6400 line printers, and I started out printing to them with code that looks like this:

buf.append( stuff );
buf.append( "\n" );

So far, so good, until I print to a 2nd printer, which in some places double-spaces the printout, and in others, just gives line feeds. So I ask them to send me a printout of the printer config, and it shows that the printer is in Proprinter Emulation mode, which has an AUTO LF setting that is enabled. Okay, so I'm thinking I should be just sending carriage returns, and let it generate the line feeds.

No good. For whatever reason, when I just:

buf.append( stuff );
buf.append( "\r" );

to send just the CR, nothing comes out. Just to say I've tried all the combinations, I change the code to:

buf.append( stuff );
buf.append( "\r\n" );

expecting to get rid of my just-line-feed issue, but also expecting the whole report to be double-spaced, and to my surprise, it works.

My guess is that Java was doing something with the line-end characters, doing me a favor when I didn't want it to, and being explicit with \r\n turned that off? I don't know. And because both printers are some distance away from my office, I didn't bother to get the folks at the 1st printer to send me their config, so I'm still guessing that they have emulation set to something with AUTO LF disabled. Maybe next time I'm out there, I'll check...

(Oh, and yeah, looks like I just managed to squeak in my one post to this blog for the year. I've been making tech notes in Google Wave recently, so when that comes out of preview mode and integrates w/Blogger publicly, I should be reviving this blog somewhat...)



Post a Comment

<< Home