コミュニティ

Problem with new processes every time we launch the flexicapture engine with Java

Dear Ms/Mr. We’ve got the following problem with the FlexiCapture Engine and we need some help in order to solve it. Every time we run our Java code in order to process a .pdf file we do this:

IEngineLoader loader = null;
IEngine engine = null;
try {
loader = Engine.CreateEngineOutprocLoader();
engine = loader.Load(PropertiesUtil.getProperty("flexicapture.key"), "");
try {
IFlexiCaptureProcessor processor = engine.CreateFlexiCaptureProcessor();
String pdfFilePath = createFile(idCliente, idProveedor, pdfFileName, pdfFileData);
String definitionFilePath = createFile(idCliente, idProveedor, plantilla.getNombreFicheroPlantilla(), plantilla.getFicheroPlantilla()); I
DocumentDefinition documentDefinition = engine.CreateDocumentDefinitionFromAFL(definitionFilePath, "Spanish"); processor.AddDocumentDefinition(documentDefinition);
if (pdfFilePath != null)
{ processor.AddImageFile(pdfFilePath); }
IDocument document = null;
while ((document = processor.RecognizeNextDocument()) != null)
{ //HERE WE READ AL THE DATA AND DO ALL THE STUFF }
if (documentDefinition != null)
{ documentDefinition.Release(); documentDefinition = null; }
// Liberar recursos File pdfFile = new File(pdfFilePath);
Files.delete(pdfFile.toPath());
File definitionFile = new File(definitionFilePath);
Files.delete(definitionFile.toPath()); }
finally {
if (engine != null)
{ engine.Release(); engine = null; }
if (loader != null)
{ loader.Unload();
loader.Release();
loader = null; }
// Engine.Unload(); }

As you can see we’re making sure of releasing all the resources and unloading the engine but we get a new process with every execution as you can see here: They remain alive in the memory with a size of around 10MB. (see attached capture)

We tried to declare the main classes of the engine as static also:
static IEngineLoader loader = null;
static IEngine engine = null;
static IFlexiCaptureProcessor processor = null;
and only instantiate them once, and we get the same result.

How can we get rid of these processes?

We really appreciate any help you can provide. Best regards.

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

1件のコメント

投稿コメントは受け付けていません。