Class BarcodeManager


  • public class BarcodeManager
    extends Object
    Utility methods for barcodes
    Since:
    8.1
    Author:
    Marco Meschieri - LogicalDOC
    • Constructor Detail

      • BarcodeManager

        public BarcodeManager()
    • Method Detail

      • extract

        public List<Barcode> extract​(com.logicaldoc.core.document.Document doc,
                                     Collection<String> possibleFormats)
                              throws IOException
        Extracts the barcodes from the given document
        Parameters:
        doc - the document to process
        possibleFormats - list of admitted barcode formats
        Returns:
        the list of extracted barcodes
        Throws:
        IOException - a generic error during the processing
      • extract

        public Barcode extract​(com.logicaldoc.core.document.Document doc,
                               BarcodeSpec zone)
                        throws IOException
        Extracts the barcode from the given document
        Parameters:
        doc - the document to process
        zone - specification of the area to process
        Returns:
        the extracted barcode
        Throws:
        IOException - a generic error during the processing
      • extractPDFZoneBarcode

        public Barcode extractPDFZoneBarcode​(File pdfScan,
                                             BarcodeSpec zone,
                                             String tenant,
                                             boolean updateSample)
        Extracts the barcode from a given zone of the scan
        Parameters:
        pdfScan - the scanned PDF
        zone - the zone to extract
        tenant - name of the current tenant
        updateSample - if the zone sample text must be updated with the barcode value
        Returns:
        the extracted barcode
      • extractZoneBarcode

        public Barcode extractZoneBarcode​(File scan,
                                          BarcodeSpec zone,
                                          String tenant,
                                          boolean updateSample)
                                   throws IOException
        Extracts the barcode from a given zone of the scan
        Parameters:
        scan - the scanned image
        zone - the zone to extract
        tenant - name of the current tenant
        updateSample - if the zone sample text must be updated with the barcode value
        Returns:
        the extracted barcode
        Throws:
        IOException - raised in case of error in processing the barcode
      • processDocument

        public void processDocument​(com.logicaldoc.core.document.Document doc,
                                    com.logicaldoc.core.document.DocumentHistory transaction,
                                    org.slf4j.Logger log)
                             throws Exception
        Throws:
        Exception
      • renderPages

        public static void renderPages​(File src,
                                       File dst,
                                       int firstPage,
                                       int lastPage)
        Renders a PDF page into a destination monochrome png. Makes use of GhostScript.
        Parameters:
        src - the source file
        dst - the rendered file
        firstPage - The first page to render(starts from 1)
        lastPage - index of the last page
      • setConfig

        public void setConfig​(com.logicaldoc.util.config.ContextProperties config)
      • setStorer

        public void setStorer​(com.logicaldoc.core.store.Storer storer)
      • setTenantDao

        public void setTenantDao​(com.logicaldoc.core.security.dao.TenantDAO tenantDao)
      • setConverterManager

        public void setConverterManager​(com.logicaldoc.core.conversion.FormatConverterManager converterManager)
      • setBarcodeTemplateDao

        public void setBarcodeTemplateDao​(BarcodeTemplateDAO barcodeTemplateDao)
      • setDocumentManager

        public void setDocumentManager​(com.logicaldoc.core.document.DocumentManager documentManager)