Example usage for org.apache.poi.xslf.extractor XSLFPowerPointExtractor close

List of usage examples for org.apache.poi.xslf.extractor XSLFPowerPointExtractor close

Introduction

In this page you can find the example usage for org.apache.poi.xslf.extractor XSLFPowerPointExtractor close.

Prototype

@Override
    public void close() throws IOException 

Source Link

Usage

From source file:com.opensearchserver.extractor.parser.Pptx.java

License:Apache License

@Override
protected void parseContent(File file, String extension, String mimeType) throws Exception {

    XSLFSlideShow pptSlideShow = new XSLFSlideShow(file.getAbsolutePath());
    XMLSlideShow slideshow = new XMLSlideShow(pptSlideShow.getPackage());

    // Extract metadata
    XSLFPowerPointExtractor poiExtractor = null;
    try {//  ww w.  jav a2 s.  co m
        poiExtractor = new XSLFPowerPointExtractor(slideshow);
        CoreProperties info = poiExtractor.getCoreProperties();
        if (info != null) {
            metas.add(TITLE, info.getTitle());
            metas.add(CREATOR, info.getCreator());
            metas.add(SUBJECT, info.getSubject());
            metas.add(DESCRIPTION, info.getDescription());
            metas.add(KEYWORDS, info.getKeywords());
            metas.add(CREATION_DATE, info.getCreated());
            metas.add(MODIFICATION_DATE, info.getModified());
        }
    } finally {
        poiExtractor.close();
    }
    extractSides(slideshow);
}

From source file:com.opensearchserver.textextractor.parser.Pptx.java

License:Open Source License

@Override
protected void parseContent(File file) throws Exception {

    XSLFSlideShow pptSlideShow = new XSLFSlideShow(file.getAbsolutePath());
    XMLSlideShow slideshow = new XMLSlideShow(pptSlideShow.getPackage());

    // Extract metadata
    XSLFPowerPointExtractor poiExtractor = null;
    try {/*from  w  ww.  j av a  2 s.  c o m*/
        poiExtractor = new XSLFPowerPointExtractor(slideshow);
        CoreProperties info = poiExtractor.getCoreProperties();
        if (info != null) {
            metas.add(TITLE, info.getTitle());
            metas.add(CREATOR, info.getCreator());
            metas.add(SUBJECT, info.getSubject());
            metas.add(DESCRIPTION, info.getDescription());
            metas.add(KEYWORDS, info.getKeywords());
            metas.add(CREATION_DATE, info.getCreated());
            metas.add(MODIFICATION_DATE, info.getModified());
        }
    } finally {
        poiExtractor.close();
    }
    extractSides(slideshow);
}