private void renderPage(PDPage page) throws IOException {
        if (config.getImageStrategy() != PDFParserConfig.IMAGE_STRATEGY.RENDER_PAGES_AT_PAGE_END) {
            return;
        }
        PDFRenderingState state = context.get(PDFRenderingState.class);
        //this is the document's inputstream/PDDocument
        //TODO: figure out if we can send in the PDPage in the TikaInputStream
        TikaInputStream tis = state.getTikaInputStream();
        Renderer renderer = config.getRenderer();
        RenderRequest request = new PageRangeRequest(getCurrentPageNo(), getCurrentPageNo());
        Metadata renderedMetadata = new Metadata();
        renderedMetadata.set(TikaCoreProperties.TYPE, PDFParser.MEDIA_TYPE.toString());
        try (RenderResults results = renderer.render(tis, renderedMetadata, context, request)) {
            for (RenderResult result : results.getResults()) {
                if (result.getStatus() == RenderResult.STATUS.SUCCESS) {
                    if (embeddedDocumentExtractor.shouldParseEmbedded(result.getMetadata())) {

                        try (TikaInputStream resultInputStream = result.getInputStream()) {
                            //TODO: add markup here?
                            embeddedDocumentExtractor.parseEmbedded(resultInputStream, xhtml,
                                    result.getMetadata(), true);
                        }
                    }
                }
            }
        } catch (SecurityException e) {
            throw e;
        } catch (Exception e) {
            handleCatchableIOE(new IOException(e));
        }
    }
Converts the given PDF document (and related metadata) to a stream
of XHTML SAX events sent to the given content handler.

@param document PDF document
@param handler  SAX content handler
@param metadata PDF metadata
@throws SAXException  if the content handler fails to process SAX events
@throws TikaException if there was an exception outside of per page processing
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/PDF2XHTML.java