Title: Message
I've started writing a Batik-applet that will work as a a graphical application where you can add "pages" (A4, A3 or whatever) and then draw to them and such.
But I'm new to Java, and don't understand much of the printing-procedure, but I've at least managed to get it to print out any page using the AOI-key of the PrintTranscoder.
 
The problem comes when I try to print out several pages. I really don't understand how to do it. Either i get x number of pages - with the same page - or I get only one page. But that's probably just cause I don't understand everything that happpens in the code (simplified to make it easier to read):
 
 
-------------------------------------------------------------------------------
 
PrintTranscoder prm;    // Alternative version: = new PrintTranscoder();

     for(int x = 1; x <= SvgEditor.getCanvas().pageCount; x++)
        {
 
         
         prm = new PrintTranscoder(); // Alternative version: Comment out this line.
         
         prm.addTranscodingHint(PrintTranscoder.KEY_AOI, SvgEditor.getCanvas().getPageAreaOfInterest(x));

          prm.addTranscodingHint(PrintTranscoder.KEY_SCALE_TO_PAGE, new Boolean(false));         
         
         prm.transcode(ti, null);
      printerJob.setPrintable(prm, pageFormat);
 
        }
     
     try{
      printerJob.print();
     }catch(Exception e){
      System.out.println(e.getMessage());
     } 
 
-------------------------------------------------------------------------------
 
If I create a new PrintTranscoder for each page (like in the code above), it will only print the last page.
But if I have the same PrintTranscoder for all the pages (Alternative version), it will print out the correct number of pages, but they will all be of the last page. So if I have 3 pages, I'll get 3 pages showing page 3.
 
Any ideas on how to solve this?

Reply via email to