[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

Printing variable length text over multiple pages

I really really need some source showing me how to print variable length text over multiple pages...
i've seen the tutorial on java2d, and it's no good... they focus on printing images.... i have a load of data in an SQL db i want to print!.
it would also be nice to know how to format the text!...
0
nielsenj
Asked:
nielsenj
1 Solution
 
vladi21Commented:
    If you simply want to print text, then write it to a file and print the
     file. Or open a filename that corresponds to the printer. On Windows,
     that is "LPT1" and the code looks like:

     try {
         FileOutputStream fos = new FileOutputStream("LPT1");
         PrintStream ps = new PrintStream(fos);
                 ps.print("Your string goes here");
                 ps.print("\f");
                 ps.close();
     } catch (Exception e) {
         System.out.println("Exception occurred: " + e);
     }

http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html
http://www.adelaide.net.au/~bmodra/PrintJob.html
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now