//Create a rendering context for form creation
PSRenderingContext formContext = new PSRenderingContext(
userAgent, gen, fontInfo, true);
ImageFlavor[] flavors;
ImageHandlerRegistry imageHandlerRegistry
= userAgent.getFactory().getImageHandlerRegistry();
flavors = imageHandlerRegistry.getSupportedFlavors(formContext);
Map hints = ImageUtil.getDefaultHints(sessionContext);
org.apache.xmlgraphics.image.loader.Image img = manager.getImage(
info, flavors, hints, sessionContext);
ImageHandler basicHandler = imageHandlerRegistry.getHandler(formContext, img);
if (basicHandler == null) {
throw new UnsupportedOperationException(
"No ImageHandler available for image: "
+ img.getInfo() + " (" + img.getClass().getName() + ")");
}