The PageFormat is not passed correctly with JDK1.5 and 1.6 (I am forced to stick with 1.4 until this is fixed).

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6296538

Please try 1.4 and see if this fixes the problem.

Patrick




Jeremias Maerki wrote:
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]


  

Important - This e-mail and the information that it contains may be
confidential, legally privileged and protected by law. Access by the
intended recipient only is authorised. Any liability (in negligence or
otherwise) arising from any third party acting, or refraining from acting,
on any information contained in this e-mail is hereby excluded. If you are
not the intended recipient, please notify the sender immediately and do not
disclose the contents to any other person, use it for any purpose, or store
or copy the information in any medium. Copyright in this e-mail and
attachments created by us belongs to the author and
also asserts the right to be identified as such and object to any misuse.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to