if (mediaSize == null)
{
logger.warn("Unknown media encountered, unable to compute page sizes.");
}
final PageFormat pageFormat = new PageFormat();
pageFormat.setPaper(createPaper(mediaSize, printableArea));
if (OrientationRequested.PORTRAIT.equals(orientationRequested))
{
pageFormat.setOrientation(PageFormat.PORTRAIT);
}
else if (OrientationRequested.LANDSCAPE.equals(orientationRequested))
{
pageFormat.setOrientation(PageFormat.LANDSCAPE);
}
else if (OrientationRequested.REVERSE_LANDSCAPE.equals
(orientationRequested))
{
pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
}
else if (OrientationRequested.REVERSE_PORTRAIT.equals(orientationRequested))
{
pageFormat.setOrientation(PageFormat.PORTRAIT);
}
return pageFormat;
}