Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

best way to print using java

  Asked By: Aditi    Date: May 06    Category: Java    Views: 969
  

Am making a Sales/Inventory program and I need a way for the sales to
print out a receipt. I heard about JFreePort but i only know so
little about it. According to the reviews, that's the best package
for printing in java. Any ideas?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Adali Fischer     Answered On: May 06

Try band printing, It's a technique where you first
print one line then go on to the next, part of the
Java 2D, look into its' API, it's quite easy, not that
fast, a bit tricky. Every line you print  can just be
that long or it will go into oblivion. You have to
break it yourself. I don't like LineBreakMesurer
though, break the lines yourself, but you could try
LineBreakMeasurer.

Tell me if you want more on this; I have created a
tiny word processor at my university and this is the
teqhnique I found to be the best one to adapt. You
could of course jut print out every JComponent, but
that's gonna get jagged and look strange and not so
professional in my opinion. So "band printing" is the
thing, I believe. Just remember to line break and it
will come out beautifully.

 
Answer #2    Answered By: Olga Kates     Answered On: May 06

What is band printing  exactly? Can you explain further?

 
Answer #3    Answered By: Milind Mishra     Answered On: May 06

Band printing  is just printing out a graphics object
like something containing a text string, you
determine, ok, now I have to go down (next line) you
start there, you calculate if there is gonna be a new
paper like on a typewriter and so on.

Anyway, take a look at this. You'll find what you
need.

www.javaworld.com/.../jw-1020-print.html

Keep in mind that though these lessons are excellent,
there is nothing that says that it will work on a mac
with os x I'm afraid, it might or it might not (A mac
doesn't send info to the printer, it creates a pdf
every time as every mac user knows)

 
Didn't find what you were looking for? Find more on best way to print using java Or get search suggestion and latest updates.




Tagged: