Exemple #1
0
        private string processOCR(string fileName)
        {
            //PDFNet.Initialize();
            //PDFNet.AddResourceSearchPath("./Lib/");
            PDFNet.SetResourcesPath("./Lib/");
            var s = PDFNet.GetResourcesPath();

            if (!OCRModule.IsModuleAvailable())
            {
                return("MODULE NOT FOUND");
            }
            try
            {
                using (PDFDoc doc = new PDFDoc(fileName))
                {
                    OCROptions opts = new OCROptions();
                    opts.AddLang("eng");
                    string jsonOCRData = OCRModule.GetOCRJsonFromPDF(doc, opts);
                    //string appendedString = getOCRDataFromJson(jsonOCRData);
                    return(jsonOCRData);
                }
                //return appenedString;
            }
            catch (PDFNetException e)
            {
                return(e.Message);
            }
        }