On 09.02.2006 11:31:56 Paul Carr wrote:
> Thanks guys,
>                      I took a look at the source for PrintTranscoder,
> and as far as I can see it doesn't query the print drivers for imageable
> area. If you could point out the bit that does this Jeremias I'd be very
> grateful.

I don't understand. As far as I can see below, you managed to find the
lines where the imageable area is accessed by the PrintTranscoder. I
meant the calls to pageFormat. Querying the printer driver for the
imageable area is done somewhere deep in the JDK. I guess I was not
precise enough.

>  I'm not using the print() method on PrintTranscoder, I've defined my
> own , the only method that gets called on PrintTranscoder when printing
> is the print(Graphics,PageFormat,int) method and this is where I'm
> getting confused. In my main class I create a PrintTranscoder &
> PrinterJob, get the pageFormat from the printerJob, set the paper to be
> a full A4 sheet, and set the imageable area to the full size of the
> page.....
>  
>                 PrinterJob printerJob = PrinterJob.getPrinterJob();
>                 PageFormat pageFormat = printerJob.defaultPage();
>                 Paper pp=pageFormat.getPaper();
>                 pp.setSize(8.25*72,11.69*72);
>                 pp.setImageableArea(0,0,8.25*72,11.69*72);
>                 pageFormat.setPaper(pp);
>                 PrintTranscoder prm = new PrintTranscoder();
>                 TranscoderInput ti = new
> TranscoderInput(svgCanvas.getSVGDocument());
>                 prm.transcode(ti, null);
>  
> I then call "setPrintable" on the PrinterJob with the new pageFormat (
> the one that should start at 0,0) and call print()
>  
>                 printerJob.setPrintable(prm,pageFormat);
>                 try
>                 {
>                      printerJob.print(); 
>                 }
>  
> I stuck a breakpoint at the start of the above method, and the start of
> the printTranscoders print(graphics,pageFormat,index) method, and
> stepped through the code. I stopped on the printerJob.print() line above
> and looked at the pageFormat......imageableArea = (0,0,594,841). I then
> stepped over it and the debugger stopped at the breakpoint at the start
> of the printTranscoders print(g,pf,i) method......looked at the
> pageFormat passed in there......imageableArea =
> (12,12,571,817).....different pageFormat !!!
> ??????????????

In that case, I'd start setting breakpoints in java.awt.print (ex:
Paper.setImageableArea()) and investigate the stack traces. No further
ideas at this time, I'm afraid.

> I've never seen this behaviour before....whenever I've called
> printerJob.setPrintable(printable,PAGEFORMAT), that is the pageFormat
> that gets passed to the printables print(g,pf,i) method.
>  
> I managed to get it printing as desired by changing PrintTranscoder to
> do 
>  
>         g.translate(0,0);
>  
> instead of using the pageFormat :-
>  
>         //g.translate(pageFormat.getImageableX(),
>         //                pageFormat.getImageableY());
>  
> but I'd obviously rather not have to do that ......  anyone got a good
> understanding of PrinterJobs / Printables who can tell me why the heck
> my pageFormat is changing en route ???? If it is querying the printer
> drivers for an imageable area, that might explain things, but I can't
> see where it's doing that, and how that gets called when you do
> PrinterJob.print()
>  
> I need to get this sorted while there are still trees left on this
> planet (My wastepaper bin is getting very heavy ;-)

Well, in Switzerland forests are getting larger. That's probably because
I use a PDF printer driver and GhostScript for these kinds of tests. :-)

<snip/>


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to