void doOCROnCurrentPage(PDPage pdPage, PDFParserConfig.OCR_STRATEGY ocrStrategy)
            throws IOException, TikaException, SAXException {
        if (ocrStrategy.equals(NO_OCR)) {
            //I don't think this is reachable?
            return;
        }
        //count the number of times that OCR would have been called
        OCRPageCounter c = context.get(OCRPageCounter.class);
        if (c != null) {
            c.increment();
        }
        MediaType ocrImageMediaType = MediaType.image("ocr-" + config.getOcrImageFormatName());
        if (!ocrParser.getSupportedTypes(context).contains(ocrImageMediaType)) {
            if (ocrStrategy == OCR_ONLY || ocrStrategy == OCR_AND_TEXT_EXTRACTION) {
                throw new TikaException(
                        "" + "I regret that I couldn't find an OCR parser to handle " +
                                ocrImageMediaType + "." +
                                "Please set the OCR_STRATEGY to NO_OCR or configure your" +
                                "OCR parser correctly");
            } else if (ocrStrategy == AUTO) {
                //silently skip if there's no parser to run ocr
                return;
            }
        }

        try (TemporaryResources tmp = new TemporaryResources()) {
            try (RenderResult renderResult = renderCurrentPage(pdPage, context, tmp)) {
                Metadata renderMetadata = renderResult.getMetadata();
                try (TikaInputStream tis = renderResult.getInputStream()) {
                    renderMetadata.set(TikaCoreProperties.CONTENT_TYPE_PARSER_OVERRIDE,
                            ocrImageMediaType.toString());
                    ocrParser.parse(tis, new EmbeddedContentHandler(new BodyContentHandler(xhtml)),
                            renderMetadata, context);
                }
            }
        } catch (IOException e) {
            handleCatchableIOE(e);
        } catch (SAXException e) {
            throw new IOException("error writing OCR content from PDF", e);
        }
    }
Format used for signature dates
TODO Make this thread-safe
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-pdf-module/src/main/java/org/apache/tika/parser/pdf/AbstractPDF2XHTML.java