Solved

Printing in java - Create a table to print

Posted on 2007-11-21
6
1,835 Views
Last Modified: 2008-02-01
i wonder if anyone can help.

I currently havea webapp that allows the user to print a table from the screen, and with css hide parts of the page that i do not want to print. But when there is a large number of rows in the table and it goes over 1 page, it looks messy and can cut halfway through a row.

I thought about using PrinterJob, but that creates a Graphice2d object for each page and then send it to the printer (if possible i could loop through the list(and for each page add 20 rows to it) but i have the problem that i do not have a clue how to create the tables using Graphice2d.

Cany anyone help me here, or have any suggestions how i can get this done.

Thanks

Ross
0
Comment
Question by:Rosscowie
6 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 20328161
http://css-discuss.incutio.com/?page=PrintingTables

Has lots of tips...  (like specifying a thead element to appear on every page)

But IE apparently still can break things when it feels like it...
0
 
LVL 4

Expert Comment

by:TheMajestic
ID: 20332560
hi,

For printing in java there is a print framework . u can use it .

The given link will give the details about it
http://www.javaworld.com/javaworld/jw-01-2001/jw-0105-print.html
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#print()

i hope it will help u a lot
0
 

Accepted Solution

by:
Rosscowie earned 0 total points
ID: 20653841
Have managed to use iText to create a PDF in browser that the user can print, this givest them more ability to change setting.
0
 
LVL 2

Expert Comment

by:Lunchy
ID: 20692282
Closed, 500 points refunded.
Lunchy
Friendly Neighbourhood Community Support Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to implement Singleton Design Pattern in Java.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now