Example #1
0
        public PDFDocument(IntPtr nativePointer)
        {
            PDFLibrary.AddRef("PDFDocument");

            m_NativePointer = nativePointer;
            m_ValidDocument = true;
        }
Example #2
0
        public PDFPage(PDFDocument document, int pageIndex)
        {
            if (document == null)
            {
                throw new NullReferenceException();
            }
            if (pageIndex < 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            PDFLibrary.AddRef("PDFPage");

            m_Document  = document;
            m_PageIndex = pageIndex;

            m_NativePointer = FPDF_LoadPage(document.NativePointer, m_PageIndex);

            if (m_NativePointer != IntPtr.Zero)
            {
                if (s_InstanceMap.ContainsKey(m_NativePointer))
                {
                    s_InstanceMap[m_NativePointer] = s_InstanceMap[m_NativePointer] + 1;
                }
                else
                {
                    s_InstanceMap[m_NativePointer] = 1;
                }
            }
        }
Example #3
0
        public PDFBookmark(PDFDocument document, PDFBookmark parentBookmark, IntPtr nativePointer, IPDFDevice device)
        {
            if (document == null)
            {
                throw new NullReferenceException();
            }

            m_ParentBookmark = parentBookmark;
            m_NativePointer  = nativePointer;
            m_Document       = document;
            m_Device         = device;

            if (m_NativePointer == IntPtr.Zero)
            {
                m_Title = "ROOT";
            }

            PDFLibrary.AddRef("PDFBookmark");

            PDFBookmark firstChild = GetFirstChild();

            if (firstChild != null)
            {
                PDFBookmark previousSibling = firstChild;

                while (previousSibling != null)
                {
                    m_Bookmarks.Add(previousSibling);
                    previousSibling = previousSibling.GetNextSibling();
                }
            }
        }
Example #4
0
        public PDFPage(PDFDocument document, IntPtr pageHandle, int pageIndex)
        {
            PDFLibrary.AddRef("PDFPage");

            m_Document  = document;
            m_PageIndex = pageIndex;

            m_NativePointer = pageHandle;
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="password">Can be null or empty</param>
        public PDFDocument(string filePath, string password)
        {
            PDFLibrary.AddRef("PDFDocument");

#if !UNITY_WEBPLAYER
            CommonInit(File.ReadAllBytes(filePath), password);
#else
            m_ValidDocument = false;
#endif
        }
Example #6
0
        public PDFLink(PDFPage page, IntPtr nativePointer)
        {
            if (page == null)
            {
                throw new NullReferenceException();
            }
            if (nativePointer == IntPtr.Zero)
            {
                throw new NullReferenceException();
            }

            PDFLibrary.AddRef("PDFLink");

            m_Page = page;

            m_NativePointer = nativePointer;
        }
Example #7
0
        public PDFAction(PDFBookmark bookmark, IntPtr nativePointer)
        {
            if (bookmark == null)
            {
                throw new NullReferenceException();
            }
            if (nativePointer == IntPtr.Zero)
            {
                throw new NullReferenceException();
            }

            PDFLibrary.AddRef("PDFAction");

            m_Source   = bookmark;
            m_Document = bookmark.Document;

            m_NativePointer = nativePointer;
        }
Example #8
0
        public PDFAction(PDFLink link, IntPtr nativePointer)
        {
            if (link == null)
            {
                throw new NullReferenceException();
            }
            if (nativePointer == IntPtr.Zero)
            {
                throw new NullReferenceException();
            }

            PDFLibrary.AddRef("PDFAction");

            m_Source   = link;
            m_Document = link.Page.Document;

            m_NativePointer = nativePointer;
        }
Example #9
0
        public PDFDest(PDFAction action, IntPtr nativePointer)
        {
            if (action == null)
            {
                throw new NullReferenceException();
            }
            if (nativePointer == IntPtr.Zero)
            {
                throw new NullReferenceException();
            }

            PDFLibrary.AddRef("PDFDest");

            m_Source   = action;
            m_Document = action.Document;

            m_NativePointer = nativePointer;
        }
Example #10
0
        public PDFTextPage(PDFPage page)
        {
            if (page == null)
            {
                throw new NullReferenceException();
            }

            PDFLibrary.AddRef("PDFTextPage");

            m_Page          = page;
            m_NativePointer = FPDFText_LoadPage(m_Page.NativePointer);

            if (m_NativePointer != IntPtr.Zero)
            {
                if (s_InstanceMap.ContainsKey(m_NativePointer))
                {
                    s_InstanceMap[m_NativePointer] = s_InstanceMap[m_NativePointer] + 1;
                }
                else
                {
                    s_InstanceMap[m_NativePointer] = 1;
                }
            }
        }
Example #11
0
        public PDFSearchHandle(PDFTextPage textPage, byte[] findWhatUnicode, int startIndex,
                               MatchOption flags = MatchOption.NONE)
        {
            if (textPage == null)
            {
                throw new NullReferenceException();
            }
            if (startIndex < 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            PDFLibrary.AddRef("PDFSearchHandle");

            m_TextPage = textPage;

            IntPtr unmanagedPointer = Marshal.AllocHGlobal(findWhatUnicode.Length);

            Marshal.Copy(findWhatUnicode, 0, unmanagedPointer, findWhatUnicode.Length);

            m_NativePointer = FPDFText_FindStart(textPage.NativePointer, unmanagedPointer, (int)flags, startIndex);

            Marshal.FreeHGlobal(unmanagedPointer);
        }
Example #12
0
 public PDFRenderer()
 {
     PDFLibrary.AddRef("PDFRenderer");
 }
Example #13
0
        /// <summary>
        /// Open PDF Document with the specified byte array.
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="password">Can be null or empty</param>
        public PDFDocument(byte[] buffer, string password)
        {
            PDFLibrary.AddRef("PDFDocument");

            CommonInit(buffer, password);
        }