Package com.logicaldoc.barcode
Class BarcodeManager
java.lang.Object
com.logicaldoc.barcode.BarcodeManager
Utility methods for barcodes
- Since:
- 8.1
- Author:
- Marco Meschieri - LogicalDOC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
extract
(com.logicaldoc.core.document.Document doc, BarcodeSpec zone) Extracts the barcode from the given documentextract
(com.logicaldoc.core.document.Document doc, Collection<String> possibleFormats) Extracts the barcodes from the given documentextract
(File file, Collection<String> possibleFormats) extractBarcodes
(File imageFile, Collection<String> possibleFormats) Recognizes all the barcodes in the given image file.extractPDFBarcodes
(File pdffile) extractPDFBarcodes
(File pdffile, Collection<String> possibleFormats) Recognizes all the barcodes in the given PDF fileextractPDFZoneBarcode
(File pdfScan, BarcodeSpec zone, String tenant, boolean updateSample) Extracts the barcode from a given zone of the scanextractZoneBarcode
(File scan, BarcodeSpec zone, String tenant, boolean updateSample) Extracts the barcode from a given zone of the scanvoid
processDocument
(com.logicaldoc.core.document.Document doc, com.logicaldoc.core.document.DocumentHistory transaction, org.slf4j.Logger log) static void
renderPages
(File src, File dst, int firstPage, int lastPage) Renders a PDF page into a destination monochrome png.void
setBarcodeTemplateDao
(BarcodeTemplateDAO barcodeTemplateDao) void
setConfig
(com.logicaldoc.util.config.ContextProperties config) void
setConverterManager
(com.logicaldoc.core.conversion.FormatConverterManager converterManager) void
setDocumentManager
(com.logicaldoc.core.document.DocumentManager documentManager) void
setStorer
(com.logicaldoc.core.store.Storer storer) void
setTenantDao
(com.logicaldoc.core.security.TenantDAO tenantDao)
-
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 processpossibleFormats
- 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 processzone
- specification of the area to process- Returns:
- the extracted barcode
- Throws:
IOException
- a generic error during the processingcom.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 PDFzone
- the zone to extracttenant
- name of the current tenantupdateSample
- 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 imagezone
- the zone to extracttenant
- name of the current tenantupdateSample
- 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
- 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
- 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 readpossibleFormats
- Collection of admitted barcode formats- Returns:
- Ordered list of barcodes (up to bottom and left to right)
- Throws:
IOException
- I/O error
-
extractPDFBarcodes
- 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 readpossibleFormats
- 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
Renders a PDF page into a destination monochrome png. Makes use of GhostScript.- Parameters:
src
- the source filedst
- the rendered filefirstPage
- 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
-
setDocumentManager
public void setDocumentManager(com.logicaldoc.core.document.DocumentManager documentManager)
-