License Question around new v8

PDF-XChange Editor SDK for Developers

Moderators: Tracker Support, TrackerSupp-Daniel, Paul - Tracker Supp, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
DolphinMann
User
Posts: 157
Joined: Mon Aug 04, 2014 7:34 pm

License Question around new v8

Post by DolphinMann » Thu Apr 11, 2019 9:33 pm

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?

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 2283
Joined: Wed Jan 03, 2018 6:52 pm

Re: License Question around new v8

Post by TrackerSupp-Daniel » Thu Apr 11, 2019 9:45 pm

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,
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

DolphinMann
User
Posts: 157
Joined: Mon Aug 04, 2014 7:34 pm

Re: License Question around new v8

Post by DolphinMann » Thu Aug 15, 2019 8:11 pm

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.

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 2283
Joined: Wed Jan 03, 2018 6:52 pm

Re: License Question around new v8

Post by TrackerSupp-Daniel » Thu Aug 15, 2019 8:26 pm

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,
Daniel McIntyre
Support Technician
Tracker Software Products (Canada) LTD

Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623

DolphinMann
User
Posts: 157
Joined: Mon Aug 04, 2014 7:34 pm

Re: License Question around new v8

Post by DolphinMann » Thu Aug 15, 2019 10:45 pm

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;

Post Reply