• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

how to print next page

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends

I am doing one printing program.
My Program skeleton is




After printing first page how can i print the next page in another paper?If i use form feed where can i use that. since all printing work are in print module i can give form feed comment with pj.

i dont know this is login problem or my program problem.javaranch people are brilient people can solve my problem easily

thanks
 
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there are more pages, then the print method shouldn't return NO_SUCH_PAGE for all subsequent pages, but instead print whatever goes onto those pages, shouldn't it?
 
meeraa pillaii
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes...but how can i print next page in my program.i am totally confused.Since PrinterJob pj = PrinterJob.getPrinterJob(); is in mail i can't give pj.print("form feed");

please help me to sort out this

Regards
 
Ulf Dittmer
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to generate form feeds - each page is imaged independently of the others. It's the responsibility of your code to figure out what goes in each page.

The pj.print() call will in turn cause the print method in your program to be called. Something like this should work:

[ July 05, 2008: Message edited by: Ulf Dittmer ]
 
meeraa pillaii
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi thank you for the replay.When i try the above code line i can print either one page i can't go the next page

int page = 0;
if (page == 0) {
// print the first page
String a = String.valueOf(page);

g.drawString("page1" + a, 90, 204);
page = 1;
}
if (page == 1) {
// print the second page
// code for more pages goes here
String a = String.valueOf(page);

g.drawString('\u000C' + a, 90, 504);
// g.drawString("page2"
} else {
return NO_SUCH_PAGE;
}




Thanks
 
Ulf Dittmer
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you introducing a variable "page"? The relevant variable is called "pageIndex", and it is part of the method signature.
 
ice is for people that are not already cool. Chill with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic