/** * Returns the raw text content of a given vfs resource containing Adobe PDF data.<p> * * @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, CmsSearchIndex) */ public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsIndexException, CmsException { logContentExtraction(resource, index); CmsFile file = readFile(cms, resource); try { return CmsExtractorPdf.getExtractor().extractText(file.getContents()); } catch (Exception e) { if (e instanceof CryptographyException) { throw new CmsIndexException( Messages.get().container(Messages.ERR_DECRYPTING_RESOURCE_1, resource.getRootPath()), e); } if (e instanceof InvalidPasswordException) { // default password "" was wrong. throw new CmsIndexException( Messages.get().container(Messages.ERR_PWD_PROTECTED_1, resource.getRootPath()), e); } throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }
/** * Returns the raw text content of a given vfs resource containing Adobe PDF data.<p> * * @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, CmsSearchIndex) */ public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsIndexException, CmsException { CmsFile file = readFile(cms, resource); try { return CmsExtractorPdf.getExtractor().extractText(file.getContents()); } catch (Exception e) { if (e instanceof CryptographyException) { throw new CmsIndexException(Messages.get().container( Messages.ERR_DECRYPTING_RESOURCE_1, resource.getRootPath()), e); } if (e instanceof InvalidPasswordException) { // default password "" was wrong. throw new CmsIndexException(Messages.get().container( Messages.ERR_PWD_PROTECTED_1, resource.getRootPath()), e); } throw new CmsIndexException( Messages.get().container(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } }