Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 02-01-2005, 01:31 AM   #1 (permalink)
freesoft_2000
Code Monkey
 
Join Date: Oct 2004
Posts: 51
freesoft_2000 is on a distinguished road
Question Double-Sided

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:

Code:
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

Code:
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

Code:
.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
freesoft_2000 is offline   Reply With Quote
Old 02-01-2005, 04:18 AM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,175
Belisarius is on a distinguished road
Can't you encapsulate that into a loop? I'm not familiar with printing in Java, but it looks like you're manually prinitng each page, so something (this is pseudo code, as I'm not sure of the actual way to access the variables):
Code:
int i = 0;
while(true){
  if(NO_SUCH_PAGE){
    break;
  }
  print(graphics, pageFormat, i);
  i = i + 2;
}
__________________
GitS
Belisarius is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Mortgage.cpp verdell32 Standard C, C++ 7 10-23-2004 07:50 AM
Double quotes in fwrite NirTivAal PHP 8 12-08-2003 09:13 AM
Help Please (Need help by Monday 29th of September!) CoW Standard C, C++ 12 10-02-2003 10:38 AM


All times are GMT -8. The time now is 12:10 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting