Example #1
0
        public string GetDatapath()
        {
            IntPtr pointer = Native.DllImports.TessBaseAPIGetDatapath((HandleRef)this);

            if (pointer == null || pointer == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                return(Marshaling.PtrToStringUTF8(pointer));
            }
        }
Example #2
0
        /// <summary>
        /// The recognized text is returned as a char* which is coded
        /// as UNLV format Latin-1 with specific reject and suspect codes
        /// and must be freed with the delete[] operator.
        /// </summary>
        public string GetUNLVText()
        {
            IntPtr pointer = Native.DllImports.TessBaseAPIGetUNLVText((HandleRef)this);

            if (pointer == null || pointer == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                string returnObject = Marshaling.PtrToStringUTF8(pointer);
                Native.DllImports.TessDeleteText(pointer); //Delete the text pointer to clear memory
                return(returnObject);
            }
        }
Example #3
0
        public string GetUTF8Text(PageIteratorLevel level)
        {
            IntPtr pointer = Native.DllImports.TessResultIteratorGetUTF8Text(handleRef, level);

            if (IntPtr.Zero != pointer)
            {
                string returnObject = Marshaling.PtrToStringUTF8(pointer);
                Native.DllImports.TessDeleteText(pointer);
                return(returnObject);
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        /// <summary>
        /// These functions are required for searchable PDF output.
        /// We need our hands on the input file so that we can include
        /// it in the PDF without transcoding.If that is not possible,
        /// we need the original image. Finally, resolution metadata
        /// is stored in the PDF so we need that as well.
        /// </summary>
        public string GetInputName()
        {
            IntPtr pointer = Native.DllImports.TessBaseAPIGetInputName((HandleRef)this);

            if (pointer == null || pointer == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                string returnObject = Marshaling.PtrToStringUTF8(pointer);
                Native.DllImports.TessDeleteText(pointer);
                return(returnObject);
            }
        }
Example #5
0
        public string GetUTF8Text()
        {
            IntPtr pointer = Native.DllImports.TessChoiceIteratorGetUTF8Text(handleRef);

            if (IntPtr.Zero != pointer)
            {
                string returnObject = Marshaling.PtrToStringUTF8(pointer);
                DllImports.TessDeleteText(pointer);
                return(returnObject);
            }
            else
            {
                return(null);
            }
        }