mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-12-21 11:13:55 +08:00
Add basic bookmarks extraction capabilities.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user