Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.8
-
None
-
None
-
Operating System: Windows XP
Platform: PC
Description
Sorry - I wasn't sure which Component to open this in. I've noticed what I
think may be a logic error in the print method of PrintTranscoder - of course,
it may also be the intended behaviour. However, if so, I found it somewhat
unexpected.
I'm using the PrintTranscoder to print an SVG document. I set the
PrintTranscoder.KEY_SHOW_PRINTER_DIALOG transcoding hint to get the printer
dialog. This shows the native printer dialog for my system, and from there I
can get to the page preferences. If I toggle the orientation to landscape,
this change does not get applied because it get's overridden by the value from
the PageFormat specified with the printable after the PrinterDialog is closed.
If changed from:
//
// If required, pop up a dialog to select the printer
//
Boolean showPrinterDialog = (Boolean)hints.get
(KEY_SHOW_PRINTER_DIALOG);
if(showPrinterDialog != null && showPrinterDialog.booleanValue
()){
if(!printerJob.printDialog())
}
// Print now
printerJob.setPrintable(this, pageFormat);
printerJob.print();
to:
// Print now
printerJob.setPrintable(this, pageFormat);
//
// If required, pop up a dialog to select the printer
//
Boolean showPrinterDialog = (Boolean)hints.get
(KEY_SHOW_PRINTER_DIALOG);
if(showPrinterDialog != null && showPrinterDialog.booleanValue
()){
if(!printerJob.printDialog()){ // Dialog was cancelled, meaning that the print process // should be stopped. return; }
}
printerJob.print();
changes made to the PageFormat from the PrintDialog are applied, which is what
I would expect to happen. However, perhaps there are reasons I haven't
thought of that make this undesirable?