Package com.logicaldoc.barcode
Class BarcodeManager
- java.lang.Object
-
- com.logicaldoc.barcode.BarcodeManager
-
public class BarcodeManager extends Object
Utility methods for barcodes- Since:
- 8.1
- Author:
- Marco Meschieri - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description BarcodeManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Barcode
extract(com.logicaldoc.core.document.Document doc, BarcodeSpec zone)
Extracts the barcode from the given documentList<Barcode>
extract(com.logicaldoc.core.document.Document doc, Collection<String> possibleFormats)
Extracts the barcodes from the given documentList<Barcode>
extract(File file, String tenant, Collection<String> possibleFormats)
List<Barcode>
extractBarcodes(File imageFile, String tenant)
List<Barcode>
extractPDFBarcodes(File pdffile, String tenant)
Barcode
extractPDFZoneBarcode(File pdfScan, BarcodeSpec zone, String tenant, boolean updateSample)
Extracts the barcode from a given zone of the scanBarcode
extractZoneBarcode(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.dao.TenantDAO tenantDao)
-
-
-
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 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
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 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 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
-
processDocument
public void processDocument(com.logicaldoc.core.document.Document doc, com.logicaldoc.core.document.DocumentHistory transaction, org.slf4j.Logger log) throws Exception
- Throws:
Exception
-
extract
public List<Barcode> extract(File file, String tenant, Collection<String> possibleFormats) throws IOException
- Throws:
IOException
-
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 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.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)
-
-