Example #1
0
        /// <summary>
        /// The getHashSHA1 method obtain a string representing the calculated hash of the current document for unique identification.
        /// </summary>
        /// <returns></returns>
        public string getHashSHA1()
        {
            StringBuilder buffer = new StringBuilder(41);

            Check(ISYS11df.IGR_Calculate_SHA1(NeedStream(), buffer, ref ecb), ecb);
            return(buffer.ToString());
        }
Example #2
0
        public int TextHeight(string text)
        {
            int width = 0, height = 0;

            Check(ISYS11df.IGR_Canvas_MeasureText(Handle, text, ref width, ref height, ref ecb));
            return(height);
        }
Example #3
0
            public static IntPtr Alloc(IGRStream stream, bool writable)
            {
                var payloadSize = Marshaler.SizeOf <Payload>();
                var retval      = Marshal.AllocHGlobal(payloadSize);
                var self        = StreamHolder.Instance.Register(stream);
                var payload     = new Payload
                {
                    Open            = Methods.Instance.Open.Item1,
                    Read            = Methods.Instance.Read.Item1,
                    Seek            = Methods.Instance.Seek.Item1,
                    Close           = Methods.Instance.Close.Item1,
                    Write           = Methods.Instance.Write.Item1,
                    StreamObjectRef = self
                };

                Marshaler.StructureToPtr <Payload>(payload, retval, false);

                if (!writable)
                {
                    Error_Control_Block ecb = new Error_Control_Block();
                    DocumentFiltersBase.Check(ISYS11df.IGR_Extend_Stream(retval, Methods.Instance.StreamCallback.Item1, retval, ref retval, ref ecb), ecb);
                }

                return(retval);
            }
Example #4
0
        /// <summary>
        /// The getHashMD5 method obtain a string representing the calculated hash of the current document for unique identification.
        /// </summary>
        /// <returns></returns>
        public string getHashMD5()
        {
            Error_Control_Block ecb    = new Error_Control_Block();
            StringBuilder       buffer = new StringBuilder(33);

            Check(ISYS11df.IGR_Calculate_MD5(NeedStream(), buffer, ref ecb), ecb);
            return(buffer.ToString());
        }
Example #5
0
        /// <summary>
        /// The width and height properties return the dimensions of a page in pixels.
        /// </summary>
        /// <returns></returns>
        public int GetWidth()
        {
            Error_Control_Block ecb = new Error_Control_Block();
            int width = 0, height = 0;

            Check(ISYS11df.IGR_Get_Page_Dimensions(Handle, ref width, ref height, ref ecb), ecb);
            return(width);
        }
Example #6
0
        /// <summary>
        /// The WordCount property returns the number of “Word”s that are on a page. The words can be enumerated using the GetFirstWord and GetNextWord methods.
        /// </summary>
        /// <returns></returns>
        public int GetWordCount()
        {
            Error_Control_Block ecb = new Error_Control_Block();
            int retval = 0;

            Check(ISYS11df.IGR_Get_Page_Word_Count(Handle, ref retval, ref ecb), ecb);
            return(retval);
        }
Example #7
0
        /// <summary>
        /// Returns the file-type information for the document
        /// </summary>
        /// <param name="what"></param>
        /// <returns></returns>
        public string getFileType(IGRFormatWhat what)
        {
            Error_Control_Block ecb    = new Error_Control_Block();
            StringBuilder       buffer = new StringBuilder(255);

            Check(ISYS11df.IGR_Get_Format_Attribute(getFileType(), (int)what, buffer, ref ecb), ecb);
            return(buffer.ToString());
        }
Example #8
0
        internal Extractor(DocumentFiltersBase parent, byte[] byteArray)
        {
            _bytes       = GCHandle.Alloc(byteArray, GCHandleType.Pinned);
            _bytesLength = (uint)byteArray.Length;

            Error_Control_Block ecb = new Error_Control_Block();

            Check(ISYS11df.IGR_Make_Stream_From_Memory(_bytes.AddrOfPinnedObject(), new System.IntPtr(_bytesLength), IntPtr.Zero, ref _streamHandle, ref ecb), ecb);
        }
Example #9
0
 /// <summary>
 /// The Close method releases any resources associated with the page.
 /// </summary>
 public void Close()
 {
     if (_pageHandle > 0)
     {
         Error_Control_Block ecb = new Error_Control_Block();
         Check(ISYS11df.IGR_Close_Page(_pageHandle, ref ecb), ecb);
         _pageHandle = 0;
     }
 }
Example #10
0
        /// <summary>
        /// IGR_Get_Page_Attribute returns style or properties of an open page; see <page> under Structured XML for a full list of options.
        /// </summary>
        /// <param name="Name"></param>
        /// <returns></returns>
        public string GetAttribute(string Name)
        {
            StringBuilder       buffer     = new StringBuilder(1024);
            int                 bufferSize = buffer.Capacity;
            Error_Control_Block ecb        = new Error_Control_Block();

            Check(ISYS11df.IGR_Get_Page_Attribute(Handle, Name, buffer, ref bufferSize, ref ecb), ecb);
            return(buffer.ToString(0, bufferSize));
        }
Example #11
0
        /// <summary>
        /// The GetText method extracts the next portion of text content from the document.
        /// </summary>
        /// <param name="maxLength"></param>
        /// <returns></returns>
        public string GetText(int maxLength)
        {
            Error_Control_Block ecb    = new Error_Control_Block();
            StringBuilder       buffer = new StringBuilder(maxLength);
            int retval = maxLength;

            Check(ISYS11df.IGR_Get_Text(NeedHandle(), buffer, ref retval, ref ecb), ecb);
            _eof = retval == 0;
            return(buffer.ToString().Substring(0, retval));
        }
Example #12
0
        /// <summary>
        /// The GetPage method returns the page at the given index, where the page index is 0-based. An exception is raised if the index is invalid.
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public Page GetPage(int page)
        {
            VerifyArgumentInRange(page, 0, _pageCount - 1, "page");
            Error_Control_Block ecb = new Error_Control_Block();
            int pageHandle          = 0;

            Check(ISYS11df.IGR_Open_Page(NeedHandle(), page, ref pageHandle, ref ecb), ecb);

            return(new Page(NeedHandle(), pageHandle));
        }
Example #13
0
 public void Close()
 {
     if (_handle > 0)
     {
         Error_Control_Block ecb = new Error_Control_Block();
         ISYS11df.Close_Instance(ref ecb);
         IGRException.Check(ecb);
         _handle = 0;
     }
 }
Example #14
0
 public void Close()
 {
     if (_handle > 0)
     {
         Check(ISYS11df.IGR_Close_Canvas(_handle, ref ecb));
         _handle = 0;
     }
     if (_streamHandle != IntPtr.Zero)
     {
         IGRStream.DestroyStreamPtr(_streamHandle);
         _streamHandle = IntPtr.Zero;
     }
 }
Example #15
0
 private void NeedWords()
 {
     if (_words == null)
     {
         Error_Control_Block ecb = new Error_Control_Block();
         int wordCount           = GetWordCount();
         _words = new IGR_Page_Word[wordCount];
         if (wordCount > 0)
         {
             Check(ISYS11df.IGR_Get_Page_Words(_pageHandle, 0, ref wordCount, _words, ref ecb), ecb);
         }
     }
 }
Example #16
0
 virtual public void Close(bool closeStream = true)
 {
     if (_handle > 0)
     {
         Check(ISYS11df.IGR_Close_File(_handle, ref ecb));
         _handle = 0;
     }
     if (closeStream && _streamHandle != IntPtr.Zero)
     {
         IGRStream.DestroyStreamPtr(_streamHandle);
         _streamHandle = IntPtr.Zero;
     }
 }
Example #17
0
        /// <summary>
        /// The FirstImage and NextImage enumerate the embedded images that are on the page. This method is useful if the page images are to be extracted and stored in separate files. These properties are not needed if the page is to be rendered into an image output canvas such as PNG, TIFF, or PDF.
        /// </summary>
        /// <returns></returns>
        public SubFile GetNextImage()
        {
            StringBuilder       id   = new StringBuilder(4096);
            StringBuilder       name = new StringBuilder(1024);
            Error_Control_Block ecb  = new Error_Control_Block();
            long date = 0;
            long size = 0;

            if (ISYS11df.IGR_Get_Page_Image_Entry(Handle, id, name, ref date, ref size, ref ecb) == 0)
            {
                return(new SubFile(this, Handle, id.ToString(), name.ToString(), size, date, ISYS11df.IGR_Extract_Page_Image_Stream));
            }
            return(null);
        }
Example #18
0
 /// <summary>
 /// Returns the capabilities mask for the document
 /// </summary>
 /// <returns></returns>
 public int getFileCapabilities()
 {
     if (_handle != 0)
     {
         return(_capabilities);
     }
     else
     {
         Error_Control_Block ecb = new Error_Control_Block();
         int caps = 0, filetype = 0;
         Check(ISYS11df.IGR_Get_Stream_Type(NeedStream(), ref caps, ref filetype, ref ecb), ecb);
         return(caps);
     }
 }
Example #19
0
        public void Open(OpenType flags, string options = "")
        {
            if (_handle > 0)
            {
                Close(false);
            }

            Check(ISYS11df.IGR_Open_Stream_Ex(NeedStream(), (int)flags, options, ref _capabilities, ref _filetype, ref _handle, ref ecb), ecb);
            if (((int)(flags) & 0xffff0000) == (int)OpenType.FormatImage)
            {
                Check(ISYS11df.IGR_Get_Page_Count(_handle, ref _pageCount, ref ecb));
            }
            _flags = flags;
        }
Example #20
0
        /// <summary>
        /// The Text property returns all the text contained on the page.
        /// </summary>
        /// <returns></returns>
        public string GetText()
        {
            if (string.IsNullOrEmpty(_pageText))
            {
                Error_Control_Block ecb    = new Error_Control_Block();
                StringBuilder       buffer = new StringBuilder(4096);
                int bufferSize             = buffer.Capacity;

                while (ISYS11df.IGR_Get_Page_Text(Handle, buffer, ref bufferSize, ref ecb) == 0)
                {
                    _pageText += buffer.ToString(0, bufferSize);
                }
            }
            return(_pageText);
        }
Example #21
0
        /// <summary>
        /// The GetNextPage methods enumerate over the pages of an opened document. Alternativily, use Pages enumeration.
        /// </summary>
        /// <returns></returns>
        public Page GetNextPage()
        {
            if (_pageIndex < _pageCount)
            {
                Error_Control_Block ecb = new Error_Control_Block();
                int pageHandle          = 0;
                Check(ISYS11df.IGR_Open_Page(NeedHandle(), _pageIndex, ref pageHandle, ref ecb), ecb);

                _pageIndex++;

                return(new Page(NeedHandle(), pageHandle));
            }
            else
            {
                return(null);
            }
        }
Example #22
0
        public void Initialize(string license, string path = "")
        {
            VerifyArgumentNotEmpty(license, "license");

            Instance_Status_Block isb = new Instance_Status_Block();
            Error_Control_Block   ecb = new Error_Control_Block();

            if (!string.IsNullOrEmpty(license) && license != "******")
            {
                isb.Licensee_ID1 = license;
            }
            else
            {
                isb.Licensee_ID1 = System.Environment.GetEnvironmentVariable("DOCFILTERS_LICENSE_KEY");
            }

            ISYS11df.Init_Instance(0, path, ref isb, ref _handle, ref ecb);
            IGRException.Check(ecb);
        }
Example #23
0
 public void SetFont(string text, int size, int style)
 {
     Check(ISYS11df.IGR_Canvas_SetFont(Handle, text, size, style, ref ecb));
 }
Example #24
0
        public string GetMemoryStatus()
        {
            StringBuilder buffer = new StringBuilder(1024);

            return(buffer.ToString(0, (int)ISYS11df.IGR_Get_Memory_Status(buffer, (uint)buffer.Capacity)));
        }
Example #25
0
 public void SetOpacity(int opacity)
 {
     Check(ISYS11df.IGR_Canvas_SetOpacity(Handle, (byte)opacity, ref ecb));
 }
Example #26
0
        internal Extractor(DocumentFiltersBase parent, string filename)
        {
            Error_Control_Block ecb = new Error_Control_Block();

            Check(ISYS11df.IGR_Make_Stream_From_File(filename, 0, ref _streamHandle, ref ecb), ecb);
        }
Example #27
0
 public void DrawScaleImage(int x, int y, int x2, int y2, byte[] imagedata, string mimetype)
 {
     Check(ISYS11df.IGR_Canvas_DrawScaleImage(Handle, x, y, x2, y2, imagedata, new IntPtr(imagedata.Length), mimetype, ref ecb));
 }
Example #28
0
 public void Rotation(int degrees)
 {
     Check(ISYS11df.IGR_Canvas_Rotation(Handle, degrees, ref ecb));
 }
Example #29
0
 public void Reset()
 {
     Check(ISYS11df.IGR_Canvas_Reset(Handle, ref ecb));
 }
Example #30
0
 public void RenderPage(Page page)
 {
     VerifyArgumentNotNull(page, "page");
     Check(ISYS11df.IGR_Render_Page(page.Handle, Handle, ref ecb));
 }