public void printWorkingPage(){
UIutils.processGUIActions();
// Set the working page to be the size of the paper
PrintOptionsDesc options = getPrintOptions();
Paper paper = options.getPaper();
int topMargin = TopMargin.get(workingPage);
int leftMargin = LeftMargin.get(workingPage);
int bottomMargin = BottomMargin.get(workingPage);
int rightMargin = RightMargin.get(workingPage);
// CraigM:06/06/2008 - The paper.getImageable values seem to be way too big. I'm guessing with my defaultMargin value.
// double x = (leftMargin != 0) ? PrintUtilities.milsToPoints(leftMargin) : paper.getImageableX();
// double y = (topMargin != 0) ? PrintUtilities.milsToPoints(topMargin) : paper.getImageableY();
// double width = (rightMargin != 0) ? options.getWidth() - PrintUtilities.milsToPoints(rightMargin) - x : paper.getImageableWidth();
// double height = (bottomMargin != 0) ? options.getHeight() - PrintUtilities.milsToPoints(bottomMargin) - y : paper.getImageableHeight();
double defaultMargin = 35;
double x = (leftMargin != 0) ? PrintUtilities.milsToPoints(leftMargin) : defaultMargin;
double y = (topMargin != 0) ? PrintUtilities.milsToPoints(topMargin) : defaultMargin;
double width = (rightMargin != 0) ? options.getWidth() - PrintUtilities.milsToPoints(rightMargin) - x : options.getWidth() - (defaultMargin*2);
double height = (bottomMargin != 0) ? options.getHeight() - PrintUtilities.milsToPoints(bottomMargin) - y : options.getHeight() - (defaultMargin*2);
// If we are in landscape mode, then we need to swap the width and height around.
if (options.getOrientation() == PageFormat.LANDSCAPE) {
double tmpWidth = width;
width = height;
height = tmpWidth;
}
// CraigM:30/05/2008 - The working page is now scaled in the BookComponentPrintable so we shouldn't set the size
// workingPage.setSize((int)width, (int)height);
paper.setImageableArea(x, y, width, height);
options.setPaper(paper);
this.append(new BookComponentPrintable(workingPage), getPrintOptions());
}