Add basic bookmarks extraction capabilities.

This commit is contained in:
BobLd
2019-11-04 15:11:54 +00:00
parent ef6d509f44
commit a8559c1167
5 changed files with 608 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>