@Test public void testEmbeddedPDF() throws Exception { Metadata metadata = new Metadata(); StringWriter sw = new StringWriter(); SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler handler = factory.newTransformerHandler(); handler.getTransformer().setOutputProperty(OutputKeys.METHOD, "xml"); handler.getTransformer().setOutputProperty(OutputKeys.INDENT, "no"); handler.setResult(new StreamResult(sw)); try (InputStream input = OOXMLParserTest.class.getResourceAsStream( "/test-documents/testWORD_embedded_pdf.docx")) { new OOXMLParser().parse(input, handler, metadata, new ParseContext()); } String xml = sw.toString(); int i = xml.indexOf("Here is the pdf file:"); int j = xml.indexOf("<div class=\"embedded\" id=\"rId5\"/>"); int k = xml.indexOf("Bye Bye"); int l = xml.indexOf("<div class=\"embedded\" id=\"rId6\"/>"); int m = xml.indexOf("Bye for real."); assertTrue(i != -1); assertTrue(j != -1); assertTrue(k != -1); assertTrue(l != -1); assertTrue(m != -1); assertTrue(i < j); assertTrue(j < k); assertTrue(k < l); assertTrue(l < m); }
public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { configure(context); OOXMLExtractorFactory.parse(stream, handler, metadata, context); }
OOXMLParser extends AbstractOfficeParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { configure(context); OOXMLExtractorFactory.parse(stream, handler, metadata, context); } }
OOXMLParser extends AbstractOfficeParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { configure(context); OOXMLExtractorFactory.parse(stream, handler, metadata, context); }  }
OOXMLParser extends AbstractOfficeParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { configure(context); OOXMLExtractorFactory.parse(stream, handler, metadata, context); }  Set<MediaType> getSupportedTypes(ParseContext context); void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context); }
OOXMLParser extends AbstractOfficeParser { public void parse( InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { configure(context); OOXMLExtractorFactory.parse(stream, handler, metadata, context); }  Set<MediaType> getSupportedTypes(ParseContext context); void parse(
            InputStream stream, ContentHandler handler,
            Metadata metadata, ParseContext context);  }