xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: Printing multiple pages
Date Thu, 13 Oct 2005 23:39:41 GMT
Hi Henric,

  You want to create one PrintTranscoder.
  Call it's transcode method N times with an input source containing each 
of your pages.
  Then call print.  The problem is that all the pages must share the same 
set of Rendering hints,
so you can't use the API hint to 'pull out' the separate parts of the 
document.  I'm not sure I 
have a good idea for  the best way to accomplish that.  The only thing I 
can think of is to
clone each of the subpages into a separate documents that you can pass to 
the transcode
method in turn.

"Henric Rosvall" <henric@opv.se> wrote on 10/13/2005 10:15:30 AM:

> 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?

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message