Example #1
0
        /// <summary>
        /// IHeart OCR and Merge Utility created by: Michael Quinton
        ///
        /// Takes the groups of input PDF files and performs OCR on the
        /// mailing address.  OCR output is overlaid with a first page marking
        /// onto the files, then all files are merged in page count order.  The
        /// resulting file is then moved to the appropriate drop folder.
        /// </summary>
        private static void Main()
        {
            Console.WriteLine("IHeart Media OCR and Merge Utility");
            if (!CheckForInputFiles())
            {
                return;
            }

            SetLeadtoolsLicense();

            foreach (var currentFolder in Constants.InputFolders)
            {
                Constants.InputDirectory.DeleteAllContents();
                GetInputFiles(currentFolder);

                if (Constants.InputDirectory.IsEmpty())
                {
                    continue;
                }

                LoadInputFileList();

                _filePageCounts = LeadToolsOcr.Process(InputFiles, currentFolder);

                PdfUtility.MergeAscendingPageCount(currentFolder, _filePageCounts);

                InputFiles.Clear();
                _filePageCounts.Clear();

                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            Constants.InputDirectory.DeleteAllContents();
            ArchiveInputFiles();
            DeleteOldErrorLogs();
        }