× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Rick,

There are two different issues here: (1) printing from Java and (2) printing to a thermal printer.

Printing from Java is relatively easy; the standard Java libraries include reasonably good printing APIs for obtaining a printer, creating pages, and using graphics primitives to populate the pages with text and/or graphics. This works great when printing to today's typical output devices (laser printers, etc.). It doesn't work so well for printing to line printers (dot matrix or whatever), and when I've had to do that in the past I've gone a bit lower level and just sent a text stream directly to the printer port, an approach which has plenty of its own issues and for which someone else may have a better solution.

With thermal printers (at least in the warehouse/shipping environments that I've worked with them in) the challenge is that each one has it's own printer control language to define the label and send data to the printer. It's really a lot like printing to a line printer, except instead of printing lines of text you're printing control instructions. Some thermal printers come with windows printer drivers that allow you to treat them as a regular windows printer (and there are third-party drivers available also) and while that would allow you to use the normal Java printing APIs but it would also mean that each label would be sent to the thermal printer as a bitmap, which tends to be grossly inefficient compared to sending raw control instructions.

If I had to do this, my approach would actually be to use a label printing tool (my choice would be Seagull Scientific's BarTender) to drive the actual label printing. The way that would work is you'd define the label layout using their GUI interface, and then from your Java code you'd either create a CSV data file or populate some DB2 tables which the label design is tied to, and let BarTender worry about the details of sending that to the printer. You can get an unlimited-user three-printer Enterprise license of BarTender for under $800, which is I suspect is much less than the cost of going it alone. The main downside of this is that BarTender is Windows only (but the printer can be connected via the network).

Alternately you could just use the regular Java printing system with a Windows driver, or you could hit the books and learn the control language for your printer and control the printer directly. Many current thermal printers actually have a direct network interface, so depending on the model you might be able to avoid issues of having to send data directly to a serial or parallel port.

Hope some of this rambling helps!

(Oh also, just in terms of general printing, there are lots of libraries both free and commercial to help you do printing/reporting from Java. I haven't used one is several years as I do all my reporting to PDF via iText, but if it wasn't for the thermal printer requirement here I'd recommend looking around for one of those, too.)

t.

On 1-Feb-07, at 9:07 AM, Rick DuVall wrote:

Hi Group,

    I have written several swing apps (desktop client ->
iSeries-i5-whatever), but have never used java to print anything. I now have a need to produce print-out on a little thermal printer as part of the new app I'm working on. Can anybody point me in the right direction? What I've found so far seems a bit convoluted. ;) Of course much of java has
struck me that way... <smile>

I continue to dig, but pointers are always welcome. Thanks in advance!

Regards,

Rick DuVall
Systems Manager
Dealer's Auto Auction of Okc, Inc.
 <mailto:rick@xxxxxxxxxx> rick@xxxxxxxxxx
(405) 947-2886
 <http://www.nothingisreal.com/dfki/no-word>
http://www.nothingisreal.com/dfki/no-word

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.