Class BarcodeManager

java.lang.Object
com.logicaldoc.barcode.BarcodeManager

@Component("BarcodeManager") public class BarcodeManager extends Object
Utility methods for barcodes
Since:
8.1
Author:
Marco Meschieri - LogicalDOC
  • Constructor Details

    • BarcodeManager

      public BarcodeManager()
  • Method Details

    • 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, com.logicaldoc.core.PersistenceException
      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
      com.logicaldoc.core.PersistenceException - Error in the data layer
    • 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
    • checkZonalBarcodeFeatureEnabled

      public void checkZonalBarcodeFeatureEnabled() throws IOException
      Throws:
      IOException
    • processDocument

      public void processDocument(com.logicaldoc.core.document.Document doc, com.logicaldoc.core.document.DocumentHistory transaction, org.slf4j.Logger log) throws com.logicaldoc.core.PersistenceException, IOException
      Throws:
      com.logicaldoc.core.PersistenceException
      IOException
    • extract

      public List<Barcode> extract(File file, Collection<String> possibleFormats) throws IOException
      Throws:
      IOException
    • extractBarcodes

      public List<Barcode> extractBarcodes(File imageFile, Collection<String> possibleFormats) throws IOException
      Recognizes all the barcodes in the given image file.
      Parameters:
      imageFile - The image file to read
      possibleFormats - Collection of admitted barcode formats
      Returns:
      Ordered list of barcodes (up to bottom and left to right)
      Throws:
      IOException - I/O error
    • extractPDFBarcodes

      public List<Barcode> extractPDFBarcodes(File pdffile) throws IOException
      Throws:
      IOException
    • extractPDFBarcodes

      public List<Barcode> extractPDFBarcodes(File pdffile, Collection<String> possibleFormats) throws IOException
      Recognizes all the barcodes in the given PDF file
      Parameters:
      pdffile - the pdf file to read
      possibleFormats - collection of admitted barcode formats
      Returns:
      ordered list of barcodes (up to bottom and left to right)
      Throws:
      IOException - In case of I/O issues
    • 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.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)