Page 1 of 1

License Question around new v8

Posted: Thu Apr 11, 2019 9:33 pm
by DolphinMann
It was not quite clear on the website as it mainly talks about the end user platform, but if we have the Editor SDK do we also get the "Advanced OCR Plugin" thing and the enhancements? If so what do we have to do special to use it if we were already using the OCRPlugin.pvp? Do we need to update languages as well? Is this different than that?

Re: License Question around new v8

Posted: Thu Apr 11, 2019 9:45 pm
by TrackerSupp-Daniel
Hello Dolphinmann,

Unfortunately, we are unable to provide access to the Enhanced OCR plugin to any SDK products due to the licensing implications involved. The original Tesseract OCR engine is still present and can be be used as before, but at this time we do not have any plans to offer the enhanced OCR in our SDK products.

As a Side note, I should also bring your attention to this news article regarding the future of our SDK's.

Kind regards,

Re: License Question around new v8

Posted: Thu Aug 15, 2019 8:11 pm
by DolphinMann
So, even without the new enhanced OCR plugin, should the original OCR plugin still work via code?

With the exact same code that works with the latest v 7.X, once I start using the v8.X version the Op.Do command returns an "Unspecified Error"

So I am a bit confused...

1.) The enhanced OCR is a purchased plugin? Where can it be purchased or used? I see that you said it cannot be used in the SDK products, but could it still be deployed and run via code through the Editor SDK?
2.) Is it still possible to use the "normal"/"old" OCR with version 8.X? If so would there be any changes to the code? Is the plugin still the same? OCRPlugin.pvp?

Mostly I am just confused because the exact same code throws errors the moment I upgrade to version 8.X with OCR(everything else still works). So mostly I just want to know if the old OCR code is still possible anymore and what if anything I need to change.

Re: License Question around new v8

Posted: Thu Aug 15, 2019 8:26 pm
by TrackerSupp-Daniel
Hello Dolphinmann,

Unfortunately, it is not possible to make use of the EOCR in any way through the SDK, only our End-user products are able to access this feature.

With that said however, the old OCR engine should certainly still be working as normal. Could I ask you to provide a code sample depicting what worked in your V7 project, that is no longer working since V8 so that our Development team can take a closer look?

Kind regards,

Re: License Question around new v8

Posted: Thu Aug 15, 2019 10:45 pm
by DolphinMann
Fails on Op.Do with "Unspecified Error" so not sure what else I can do. Replace the v8/v7 can directly cause it to succeed or fail with no other changes.

Init Called first

Code: Select all

        public static void Init()
        {
            if (viewerInstance == null)
            {
                try
                {
                    viewerInstance = new PXV_Inst();
                    viewerInstance.Init(null, PDFProcessTools.devKey);

                    Logger.Log("PDF Converter Object Initialized", 5);

                    string pluginLoadPath = Environment.GetEnvironmentVariable("DolphinPath");
                    viewerInstance.StartLoadingPlugins();
                    viewerInstance.AddPluginFromFile(pluginLoadPath + @"OCRPlugin.pvp");
                    Logger.Log("PDF Plugin Loaded: " + pluginLoadPath + @"OCRPlugin.pvp", 5);
                    viewerInstance.AddPluginFromFile(pluginLoadPath + @"ConvertPDF.pvp");
                    Logger.Log("PDF Plugin Loaded: " + pluginLoadPath + @"ConvertPDF.pvp", 5);
                    viewerInstance.AddPluginFromFile(pluginLoadPath + @"PDFAPlugin.pvp");
                    Logger.Log("PDF Plugin Loaded: " + pluginLoadPath + @"PDFAPlugin.pvp", 5);
                    viewerInstance.FinishLoadingPlugins();
                    Logger.Log("All PDF Plugins Loaded", 5);

                    try
                    {
                        PDFProcessTools.PDFProcessToolsTimeoutInMin = 10;
                        //PDFProcessTools.PDFProcessToolsTimeoutInMin = System.Convert.ToInt32(ApplicationSettings.ReadSettingFromProfile(ConfigurationSettings.PDFToolsTimeoutInMin.ToString(), "Default"));
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Failed to read PDFTool Timeout. Defaulting to 10 min", ex, 1);
                        PDFProcessTools.PDFProcessToolsTimeoutInMin = 10;
                    }

                    if (!Directory.Exists(@"C:\Windows\System32\config\systemprofile\Desktop\"))
                    {
                        try
                        {
                            Directory.CreateDirectory(@"C:\Windows\System32\config\systemprofile\Desktop\");
                        }
                        catch (Exception ex)
                        {
                            Logger.Log("Failed to create PDF XChange Office conversion directory : " +
                                @"C:\Windows\System32\config\systemprofile\Desktop\" +
                                ". It may need to be created manually as this is a required directory", ex, 1);
                        }
                    }

                    if (!Directory.Exists(@"C:\Windows\SysWOW64\config\systemprofile\Desktop\"))
                    {
                        try
                        {
                            Directory.CreateDirectory(@"C:\Windows\SysWOW64\config\systemprofile\Desktop\");
                        }
                        catch (Exception ex)
                        {
                            Logger.Log("Failed to create PDF XChange Office conversion directory : " +
                                @"C:\Windows\SysWOW64\config\systemprofile\Desktop\" +
                                ". It may need to be created manually as this is a required directory", ex, 1);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log("Error During Init for PDFProcessTools64", ex, 1);
                    int hr = Marshal.GetHRForException(ex);
                    PDFProcessTools.LogErrMsg(hr);
                }
            }

            if (auxInst == null)
            {
                try
                {
                    auxInst = (IAUX_Inst)viewerInstance.GetExtension("AUX");
                }
                catch (Exception ex)
                {
                    Logger.Log("Error During Init for PDFProcessTools64", ex, 1);
                    int hr = Marshal.GetHRForException(ex);
                    PDFProcessTools.LogErrMsg(hr);
                }
            }
        }
Then OCR:

Code: Select all

            bool returnValue = false;
            PDFXEdit.IPXC_Document doc = null;
            PDFXEdit.IOperation Op = null;
            PDFXEdit.ICabNode options = null;
            PDFXEdit.ICabNode input = null;

            try
            {
                if (File.Exists(inputPDF))
                {
                    string pageValues = "";
                    PDFXEdit.IPXC_Inst pxcInst = (PDFXEdit.IPXC_Inst)viewerInstance.GetExtension("PXC");
                    doc = pxcInst.OpenDocumentFromFile(inputPDF, clbk);

                    int nID = viewerInstance.Str2ID("op.document.OCRPages", false);
                    Op = viewerInstance.CreateOp(nID);
                    input = Op.Params.Root["Input"];
                    input.v = doc;
                    options = Op.Params.Root["Options"];

                    if (pages.Length == 0 || (pages.Length == 1 && pages[0] == -1))
                    {
                        options["PagesRange.Type"].v = "All";
                        pageValues = "All";
                    }
                    else
                    {
                        options["PagesRange.Type"].v = "Exactly";

                        for (int count = 0; count < pages.Length; count++)
                        {
                            if (pageValues != "")
                            {
                                pageValues += ",";
                            }

                            pageValues += System.Convert.ToString(pages[count]);
                        }

                        options["PagesRange.Text"].v = pageValues;
                    }

                    options["OutputType"].v = 0;
                    options["OutputDPI"].v = 300;
                    options["ExtParams.Language"].v = languages;

                    Logger.Log("Attempting to execute OCR on document: " + inputPDF + " with pages: " + pageValues + " and languages: " + languages, 5);
                    Op.Do();

                    doc.WriteToFile(inputPDF);
                    Logger.Log("PDF File: " + inputPDF + " had OCR completed", 5);

                    doc.Close();
                    options.Clear();
                    input.Clear();
                    pxcInst = null;
                    returnValue = true;
                }
                else
                {
                    Logger.Log("PDF File: " + inputPDF + ", does not exist. Cannot execute OCR", 1);
                }
            }
            catch (Exception ex)
            {
                Logger.Log("Error running OCR on PDF: " + inputPDF, ex, 1);
                int hr = Marshal.GetHRForException(ex);
                PDFProcessTools.LogErrMsg(hr);
                returnValue = false;
            }
            finally
            {
                if (doc != null)
                {
                    doc.Close();
                    doc = null;
                }
                if (options != null)
                {
                    options.Clear();
                    options = null;
                }
                if (input != null)
                {
                    input.Clear();
                    input = null;
                }
            }

            return returnValue;

Re: License Question around new v8

Posted: Tue Aug 27, 2019 6:41 am
by Sasha - Tracker Dev Team
Hello DolphinMann,

Sorry for the long reply - we've been very busy with the release and now I will tend to the forums. Will see through the problem and will reply to you asap.

Cheers,
Alex

Re: License Question around new v8

Posted: Tue Aug 27, 2019 8:02 am
by Sasha - Tracker Dev Team
Hello DolphinMann,

I think the problem is with the dll registration method and the new version of the SDK. From what I know, due to the new EOCR engine, the folder structure of the dictionaries (if i'm not mistaken, now there is a Common folder) was changed and thus there can be a problem if you are using a dynamic dll load. Try using the regsvr32 method for pure testing and try registering the dll from the new Editor SDK version folder.

Cheers,
Alex

Re: License Question around new v8

Posted: Wed Aug 28, 2019 6:59 am
by DolphinMann
Sorry, do you mean run regsvr32 on the DLL in addition to what the installer does?

Re: License Question around new v8

Posted: Wed Aug 28, 2019 7:07 am
by Sasha - Tracker Dev Team
Hello DolphinMann,

Yes, let us try that to ensure the correct dll is being used, and also, you should switch your program from custom manifest (if you have one) to regsvr dll usage. This is purely for the experiment so that we can find out what exactly broke in the OCR.

Cheers,
Alex