Hi

Can anyone please help me as to how to print in java? Please tell me the basics first and then how to change the configurations.Actually I need to print in a thermal paper for issuing tickets. Can anyone please help?

Thanks

Abhik

You could take a look at the following:-

Printing in Java
(Very old article so information could be obsolete)
Java Print Service (1,2,3)

I have seen this article and it is obsolete.Can you suggest something newer?

How do you know it's obsolete if you don't know whether something newer exists? Obsolete means there is a newer method, not that the article describing the current method is old. ;)

If you just want a recently updated article, the Java Tutorial is a good start.

commented: Lovely application of logic :P +5

I have seen this article and it is obsolete.Can you suggest something newer?

There were Two Points suggested, Did you look at the second one mentioning the Java Print Service ?

Actually I am trying to print from a thermal printer.. it will be a bill. so can anyone please mention the attributes required, like page,page size etc. I know java has the interface PrintRequestAttributeSet which is an interface for a set of
print request attributes.so can anyone please tell me the attributes reqd for thermal printing?

Thanks

Abhik

Ah sorry, I missed that part of your original question.

I have no idea what settings you need either. I assume that if you have the thermal paper there, you can measure it and get a rough estimate of what page size etc you'll need. Experimentation will eventually give you the settings that you need to use.

The Java API doc page for PrintRequestAttributeSet
http://java.sun.com/javase/6/docs/api/javax/print/attribute/PrintRequestAttributeSet.html

Use the method add(Attribute attribute) to add an Attribute to the set (that method returns a boolean, true if adding the Attribute worked)

More information about the Attribute class:
http://java.sun.com/javase/6/docs/api/javax/print/attribute/Attribute.html

I also used Google and found a few potentially useful resources for you to read:
http://archive.midrange.com/java400-l/200702/msg00004.html
http://rooreynolds.com/category/microprinter/
(Both of those look like interesting articles)

Let us know how you go.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.