• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

how to print next page

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bras cause cancer. And tiny ads:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic