else {
// arbitrary but sensible default, mostly backwards compatible
pixelsPerInch = 300;
}
profile = null;
XmlNode profileNode = null;
try {
profileNode = root.getChild(ProfileTag);
}
catch (XMLException e) {
// OK, color profile is optional.
}
if (profileNode != null) {
String profileName = profileNode.getAttribute(ProfileNameTag);
String profilePath = profileNode.getAttribute(ProfilePathTag);
profile = new ColorProfileInfo(profileName, profilePath);
}
XmlNode pageNode = root.getChild(PageTag);
restorePageFormat(pageNode);
XmlNode imageRectNode = root.getChild(ImageRectTag);
try {
double x = Double.valueOf(imageRectNode.getAttribute("x"));
double y = Double.valueOf(imageRectNode.getAttribute("y"));
double w = Double.valueOf(imageRectNode.getAttribute("w"));
double h =
Double.valueOf(imageRectNode.getAttribute("h"));
imageRect = new Rectangle2D.Double(x, y, w, h);
// The restored imageRect may not make sense with the current
// imageWidth and imageHeight.
// If the saved aspect ratio is far off, then we scaleToFit().