Exemplo n.º 1
0
        /// <summary>
        /// Builds bookmark object.
        /// </summary>
        public void Build()
        {
            if (_mainComponent.PDFiumBridge == null || !_mainComponent.PDFiumDocument.IsValid)
            {
                return;
            }

            var childBookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetFirstChild(_mainComponent.PDFiumDocument, _bookmarkHandle);

            while (childBookmarkHandle.IsValid)
            {
                var newBookmark = new PDFBookmark(_mainComponent, childBookmarkHandle);
                newBookmark.Build();
                Bookmarks.Add(newBookmark);
                childBookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetNextSibling(_mainComponent.PDFiumDocument, childBookmarkHandle);
            }
        }
        /// <summary>
        /// <inheritdoc/>
        /// </summary>
        public void DocumentOpened(string file)
        {
            if (_mainComponent.PDFiumBridge == null || !_mainComponent.PDFiumDocument.IsValid)
            {
                return;
            }

            var bookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetFirstChild(_mainComponent.PDFiumDocument, FPDF_BOOKMARK.InvalidHandle);

            while (bookmarkHandle.IsValid)
            {
                var newBookmark = new PDFBookmark(_mainComponent, bookmarkHandle);
                newBookmark.Build();
                Bookmarks.Add(newBookmark);
                bookmarkHandle = _mainComponent.PDFiumBridge.FPDFBookmark_GetNextSibling(_mainComponent.PDFiumDocument, bookmarkHandle);
            }

            InvokePropertyChangedEvent(nameof(Bookmarks));
        }