Package com.logicaldoc.zonalocr
Class ZonalOCR
java.lang.Object
com.logicaldoc.zonalocr.ZonalOCR
The Zonal OCR engine
- Since:
 - 8.4.2
 - Author:
 - Marco Meschieri - LogicalDOC
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionextractZoneText(File scan, Zone zone, Locale locale, String tenant, boolean updateSample) Uses the OCR to extract the text from the given zonevoidprocessDocument(long docId, com.logicaldoc.core.document.DocumentHistory transaction) Processes a document using a given OCR template, the first page is elaborated and the extracted zones are used to fill the document's extended attributes.processFile(File scan, OCRTemplate template, com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction) Processes a file using a given templatevoidsetDocumentDao(com.logicaldoc.core.document.dao.DocumentDAO documentDao) voidsetDocumentManager(com.logicaldoc.core.document.DocumentManager documentManager) voidsetOcrManager(OCRManager ocrManager) voidsetOcrTemplateDao(OCRTemplateDAO ocrTemplateDao) voidsetTemplateDao(com.logicaldoc.core.metadata.TemplateDAO templateDAO) voidsetTenantDao(com.logicaldoc.core.security.dao.TenantDAO tenantDao)  
- 
Constructor Details
- 
ZonalOCR
public ZonalOCR() 
 - 
 - 
Method Details
- 
processDocument
public void processDocument(long docId, com.logicaldoc.core.document.DocumentHistory transaction) throws com.logicaldoc.core.PersistenceException, IOException Processes a document using a given OCR template, the first page is elaborated and the extracted zones are used to fill the document's extended attributes.- Parameters:
 docId- the document to processtransaction- informations about the operation- Throws:
 com.logicaldoc.core.PersistenceException- Error in the persistence layerIOException- I/O error
 - 
processFile
public Map<String,Object> processFile(File scan, OCRTemplate template, com.logicaldoc.core.document.Document document, com.logicaldoc.core.document.DocumentHistory transaction) Processes a file using a given template- Parameters:
 scan- the image file to processtemplate- the OCR template that describes the zonesdocument- the document being processedtransaction- informations about the operation- Returns:
 - the map zone_name-zone_value
 
 - 
extractZoneText
public String extractZoneText(File scan, Zone zone, Locale locale, String tenant, boolean updateSample) throws IOException Uses the OCR to extract the text from the given zone- Parameters:
 scan- the original scan filezone- the zone to extractlocale- a locale to use as hint for the OCR, if null the zone's one will be used insteadtenant- name of the current tenantupdateSample- update the sample of the zone(sample and sampleText attributes)- Returns:
 - The text extracted by the OCR
 - Throws:
 IOException- an error occurred processing the image or executing the OCR
 - 
setTenantDao
public void setTenantDao(com.logicaldoc.core.security.dao.TenantDAO tenantDao)  - 
setOcrManager
 - 
setOcrTemplateDao
 - 
setTemplateDao
public void setTemplateDao(com.logicaldoc.core.metadata.TemplateDAO templateDAO)  - 
setDocumentDao
public void setDocumentDao(com.logicaldoc.core.document.dao.DocumentDAO documentDao)  - 
setDocumentManager
public void setDocumentManager(com.logicaldoc.core.document.DocumentManager documentManager)  
 -