* @param doc DOM document representing the XML document
* @param ns Namespace for the document
* @param pos Position on the page
*/
public void renderDocument(Document doc, String ns, Rectangle2D pos) {
RendererContext context;
context = new RendererContext(this, MIME_TYPE);
context.setUserAgent(userAgent);
context.setProperty(PDFRendererContextConstants.PDF_DOCUMENT, pdfDoc);
context.setProperty(PDFRendererContextConstants.OUTPUT_STREAM, ostream);
context.setProperty(PDFRendererContextConstants.PAGE_VIEWPORT, getCurrentPageViewport());
context.setProperty(PDFRendererContextConstants.PDF_STATE, currentState);
context.setProperty(PDFRendererContextConstants.PDF_PAGE, currentPage);
context.setProperty(PDFRendererContextConstants.PDF_CONTEXT,
currentContext == null ? currentPage : currentContext);
context.setProperty(PDFRendererContextConstants.PDF_CONTEXT, currentContext);
context.setProperty(PDFRendererContextConstants.PDF_STREAM, currentStream);
context.setProperty(PDFRendererContextConstants.XPOS,
new Integer(currentIPPosition + (int) pos.getX()));
context.setProperty(PDFRendererContextConstants.YPOS,
new Integer(currentBPPosition + (int) pos.getY()));
context.setProperty(PDFRendererContextConstants.PDF_FONT_INFO, fontInfo);
context.setProperty(PDFRendererContextConstants.PDF_FONT_NAME, currentFontName);
context.setProperty(PDFRendererContextConstants.PDF_FONT_SIZE,
new Integer(currentFontSize));
context.setProperty(PDFRendererContextConstants.WIDTH,
new Integer((int) pos.getWidth()));
context.setProperty(PDFRendererContextConstants.HEIGHT,
new Integer((int) pos.getHeight()));
renderXML(context, doc, ns);
}