private void restorePageFormat(XmlNode pageRoot) throws XMLException {
int orientation =
Integer.parseInt(pageRoot.getAttribute(OrientationTag));
pageFormat.setOrientation(orientation);
Paper paper = pageFormat.getPaper();
XmlNode paperNode = pageRoot.getChild(PaperTag);
// Backwards compatibility: releases 1.0.5 and earlier omitted
// Paper width and height.
if (paperNode.hasAttribute("width") && paperNode.hasAttribute("height")) {
double width = Double.parseDouble(paperNode.getAttribute("width"));
double height = Double.parseDouble(paperNode.getAttribute("height"));
paper.setSize(width, height);
}
double x = Double.parseDouble(paperNode.getAttribute("x"));
double y = Double.parseDouble(paperNode.getAttribute("y"));
double w = Double.parseDouble(paperNode.getAttribute("w"));
double h = Double.parseDouble(paperNode.getAttribute("h"));
paper.setImageableArea(x, y, w, h);
pageFormat.setPaper(paper);
}