Ephesoft is a great open architecture capture platform, and it is easy to find blogs and articles that support this. However, not as much is available out there to provide solution or development tips for the platform. So, as one of the frontier Ephesoft developers who did not have the luxury of Googling my way out, I wanted to start sharing some of the solution tips in a series of blogs.
Blog 1 – Batch Separation
Batch separation is a commonly sought after feature of document capture solution for clients with high volume scanning requirements. With other industry leading capture platforms, batch separation is as easy as marking a checkbox. However, with these other “checkbox solutions”, a downturn is that you do not have a chance to inspect scanned images because initial batches separated are sent to the process automatically and you can only inspect the last batch. With Ephesoft, you will have a chance to validate scanned images since the batch separation is deferred to later in the process.
The main strategy behind batch separation is using 2 batch classes back to back:
The first batch class is used exclusively to separate batches, and separated batches are exported back to an import folder
The second batch class performs classification, extraction, export and any other necessary tasks.
The diagram below shows an example of batch separation using barcode batch covers.
As shown in the process flow diagram below, the batch class is very light and only has 4 module steps and 6 plugins. It would take no more than an hour to configure the separation batch class, but you would have to spend some time on the Document Assembler scripting depending on what customization you want with the scripting.
In this example Batch Class, outputDoc, dropFile, copyFile methods as shown below are used to export documents to a designated directory as single page images. The design of Export of documents as single image files has been chosen to reduce the time to assemble during export and dissemble documents during import the main process.
private void outputDoc(Document documentFile) { Element BatchID = (Element) documentFile.getRootElement().getChild(BATCH_INSTANCE_ID); if (BatchID == null) { return; } Element BatchPath = (Element) documentFile.getRootElement().getChild(BATCH_LOCAL_PATH); if (BatchPath == null) { return; } String batID = BatchID.getValue(); String batPath = BatchPath.getValue(); String fullPath = batPath + File.separator + batID; Element documentsList = (Element) documentFile.getRootElement().getChild(DOCUMENTS); if (documentsList == null) { return; } List<?> documentList = documentsList.getChildren(); if (documentList == null) { return; } // loop each doc list for (int i = 0; i < documentList.size(); i++) { Element docEle = (Element) documentList.get(i); //doc element List<?> pageList = docEle.getChildren(PAGES); Element docIdentifier = docEle.getChild(IDENTIFIER); String docID = docIdentifier.getValue(); for (int j = 0; j < pageList.size(); j++) { Element pageEle = (Element) pageList.get(j); // page element Element pageFile = pageEle.getChild(PAGE); String pageFileName = pageFile.getChild("NewFileName").getValue(); String imageFullPath = fullPath + File.separator + pageFileName; String root = "C:\\Ephesoft\\SharedFolders\\DocumentSeparator_Import"; String newPath = root + File.separator + batID + "-" + docID; String newFullPath = newPath + File.separator + pageFileName; try { File newDirectory = new File(newPath); if (!newDirectory.exists()) { System.out.println("new"); newDirectory.mkdir(); } } catch (Exception el){ // ignore it or error output } try { java.io.File f = new java.io.File(imageFullPath); if (f.exists()) { dropFile(imageFullPath, newPath); } } catch (Exception e1) { // ignore it or error output } } } } public static void dropFile(String imageFullPath, String newPath) { try { java.io.File f = new java.io.File(imageFullPath); if (f.exists()) { copyFile(f, new File(newPath)); } else { System.out.println("no source to copy from"); } } catch (Exception el) { el.printStackTrace(); } } public static void copyFile(File sourcFile, File destFile) throws IOException { if(!destFile.exists()) { destFile.createNewFile(); } FileChannel source = null; FileChannel destination = null; try { source = new FileInputStream(sourceFile).getChannel(); destination = new FileOutputStream(destFile).getChannel(); destination.transferFrom(source, 0, source.size()); } finally { if(source != null) { source.close(); } if(destination != null) { destination.close(); } } }
Please comment below if you have any questions. Also, feel free to suggest other solutions or Ephesoft topics that you would be interested in learning more about. I would like to thank Chris MacWilliams, sales engineer at Ephesoft, for providing me with ideas and support.
0 Comments