final int row,
final int col,
final PhysicalPageKey pageKey)
throws DocumentException
{
final PhysicalPageBox page = pageGrid.getPage(row, col);
if (page == null)
{
return;
}
final float width = (float) StrictGeomUtility.toExternalValue(page.getWidth());
final float height = (float) StrictGeomUtility.toExternalValue(page.getHeight());
final Rectangle pageSize = new Rectangle(width, height);
final float marginLeft = (float) StrictGeomUtility.toExternalValue(page.getImageableX());
final float marginRight = (float) StrictGeomUtility.toExternalValue
(page.getWidth() - page.getImageableWidth() - page.getImageableX());
final float marginTop = (float) StrictGeomUtility.toExternalValue(page.getImageableY());
final float marginBottom = (float) StrictGeomUtility.toExternalValue
(page.getHeight() - page.getImageableHeight() - page.getImageableY());
final Document document = getDocument();
document.setPageSize(pageSize);
document.setMargins(marginLeft, marginRight, marginTop, marginBottom);