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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidextract(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 scanvoidprocessDocument(com.logicaldoc.core.document.Document doc, com.logicaldoc.core.document.DocumentHistory transaction, org.slf4j.Logger log) static voidrenderPages(File src, File dst, int firstPage, int lastPage) Renders a PDF page into a destination monochrome png.
- 
Constructor Details- 
BarcodeManagerpublic BarcodeManager()
 
- 
- 
Method Details- 
extractpublic 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
 
- 
extractpublic 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
 
- 
extractPDFZoneBarcodepublic 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
 
- 
extractZoneBarcodepublic 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- Throws:
- IOException
 
- 
processDocumentpublic 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
 
- 
extractBarcodespublic 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- Throws:
- IOException
 
- 
extractPDFBarcodespublic 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
 
- 
renderPagesRenders 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
 
 
-