freesoft_2000 9 Practically a Master Poster

Hi everyone,

I am currently trying to print a swing component a JTable to be exact but the thing is that i want my user to be able to print even, odd or all the pages. The thing is i am using the swing print dialog and not the windows native one.

When i write i use the printer job the java printing system will call the page indexes as follows:

print(graphics, pageFormat, 0) 
print(graphics, pageFormat, 1)
print(graphics, pageFormat, 2)

As you can see from above all the page numbers are called sequentially until NO_SUCH_PAGE is returned.

Well what i am trying to say is that is possible to make the java printing system only call odd page indexes
something like this

print(graphics, pageFormat, 0) 
print(graphics, pageFormat, 2)
print(graphics, pageFormat, 4)

I know that it is also possible to print double side page by adding attributes to the PrintRequestAttributeSet class by using the below line

.add(Sides.DUPLEX)

This is not a very good option as it requires an expensive printer for this and not many users have this type of expensive printer.

I hope i haven't confused you guys and maybe someone can explain or guide me to a way to printing even and odd pages.

Please note that the JTable is three pages long

Thank You

Yours Sincerely

Richard West

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.