pi.getPageable().getPageFormat(0).setOrientation(pageFormatOrientation);  MediaPrintableArea mediaPrintableArea = (MediaPrintableArea) printRequestAttributeSet.get(MediaPrintableArea.class);  Paper paper = pi.getPageable().getPageFormat(0).getPaper();  paper.setImageableArea(mediaPrintableArea.getX(MediaPrintableArea.INCH) * 72.0, mediaPrintableArea.getY(MediaPrintableArea.INCH) * 72.0, mediaPrintableArea.getWidth(MediaPrintableArea.INCH) * 72, mediaPrintableArea.getHeight(MediaPrintableArea.INCH) * 72);  pi.getPageable().getPageFormat(0).setPaper(paper);   com.cosylab.vdct.graphics.printing.Page.setPageFormat(pi.getPageable().getPageFormat(0));  setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));  Thread.yield(); printerJob.print(printRequestAttributeSet);
public void printMenuItem_ActionPerformed() {	final GetPrintableInterface pi = (GetPrintableInterface)CommandManager.getInstance().getCommand("GetPrintableInterface");	if (pi!=null)	new Thread() {		public void run() {			try {				PrinterJob job = PrinterJob.getPrinterJob();				job.setJobName(getTitle());				job.setPageable(pi.getPageable());				if (job.printDialog())				{					setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));					Thread.yield();					job.print();				}			} catch (PrinterException ex) {				ex.printStackTrace();				com.cosylab.vdct.Console.getInstance().println("Printing error: "+ex);			}			finally			{				setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR));			}		}	}.start();}