merge pull request #84 from BobLd/master

add basic bookmarks extraction capabilities.
This commit is contained in:
Eliot Jones
2019-12-04 14:24:10 +00:00
committed by GitHub
6 changed files with 610 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
using Parser;
using Tokenization.Scanner;
using Tokens;
using UglyToad.PdfPig.Outline;
using Util.JetBrains.Annotations;
/// <inheritdoc />
@@ -197,6 +198,23 @@
return true;
}
/// <summary>
/// Gets the bookmarks if this document contains some.
/// </summary>
/// <remarks>This will throw a <see cref="ObjectDisposedException"/> if called on a disposed <see cref="PdfDocument"/>.</remarks>
public bool TryGetBookmarks(out Bookmarks bookmarks)
{
if (isDisposed)
{
throw new ObjectDisposedException("Cannot access the bookmarks after the document is disposed.");
}
var bookmarksProvider = new BookmarksProvider(this.log, this.Structure);
bookmarks = bookmarksProvider.GetBookmarks();
if (bookmarks != null) return true;
return false;
}
/// <summary>
/// Gets the form if this document contains one.
/// </summary>