Class ZonalOCR

  • public class ZonalOCR
    extends Object
    The Zonal OCR engine
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • ZonalOCR

        public ZonalOCR()
    • Method Detail

      • processDocument

        public void processDocument​(long docId,
                                    com.logicaldoc.core.document.DocumentHistory transaction)
                             throws Exception
        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.
        docId - the document to process
        transaction - informations about the operation
        Exception - error during the whole elaboration
      • 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
        scan - the image file to process
        template - the OCR template that describes the zones
        document - the document being processed
        transaction - informations about the operation
        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
        scan - the original scan file
        zone - the zone to extract
        locale - a locale to use as hint for the OCR, if null the zone's one will be used instead
        tenant - name of the current tenant
        updateSample - update the sample of the zone(sample and sampleText attributes)
        The text extracted by the OCR
        IOException - an error occurred processing the image or executing the OCR
      • setTenantDao

        public void setTenantDao​( tenantDao)
      • setOcrManager

        public void setOcrManager​(OCRManager ocrManager)
      • setOcrTemplateDao

        public void setOcrTemplateDao​(OCRTemplateDAO ocrTemplateDao)
      • 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)