Skip to main content

IPdfDocument Interface

Definition​

Assembly:Avalonia.Controls.PdfViewer
Package:Avalonia.Controls.PdfViewer

Represents a loaded PDF document.

public interface IPdfDocument

Implements: IDisposable

Methods​

NameDescription
GetOutlineGets the document outline (bookmarks).
GetPageGets a page by index (0-based).
GetPageSizeGets page dimensions without loading the full page.
GetUserBookmarksReads user-created bookmarks (saved page positions) from the document's XMP metadata. These are the Preview-style bookmarks stored under the apple-preview namespace, distinct from the author outline returned by Avalonia.Controls.Pdf.Core.IPdfDocument.GetOutline. Returns an empty list when the document has none.

GetOutline Method​

Gets the document outline (bookmarks).

public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.Pdf.Core.PdfBookmark> GetOutline()

Returns​

System.Collections.Generic.IReadOnlyList<Avalonia.Controls.Pdf.Core.PdfBookmark>

GetPage Method​

Gets a page by index (0-based).

public Avalonia.Controls.Pdf.Core.IPdfPage GetPage(int index)

Parameters​

index int

Returns​

Avalonia.Controls.Pdf.Core.IPdfPage

GetPageSize Method​

Gets page dimensions without loading the full page.

public ValueTuple<double, double> GetPageSize(int index)

Parameters​

index int

Returns​

ValueTuple<double, double>

GetUserBookmarks Method​

Reads user-created bookmarks (saved page positions) from the document's XMP metadata. These are the Preview-style bookmarks stored under the apple-preview namespace, distinct from the author outline returned by Avalonia.Controls.Pdf.Core.IPdfDocument.GetOutline. Returns an empty list when the document has none.

public System.Collections.Generic.IReadOnlyList<Avalonia.Controls.Pdf.Core.PdfUserBookmark> GetUserBookmarks()

Returns​

System.Collections.Generic.IReadOnlyList<Avalonia.Controls.Pdf.Core.PdfUserBookmark>

Properties​

NameDescription
IsPasswordProtectedGets whether the document is password-protected.
MetadataGets document metadata.
PageCountGets the total number of pages.
PermissionsGets the raw PDF permission bits (as returned by the PDF security handler). 0xFFFFFFFF means no restrictions.
VersionGets the PDF version (e.g., "1.7" for PDF 1.7).

IsPasswordProtected Property​

Gets whether the document is password-protected.

public bool IsPasswordProtected { get; set; }

Metadata Property​

Gets document metadata.

public Avalonia.Controls.Pdf.Core.PdfMetadata Metadata { get; set; }

PageCount Property​

Gets the total number of pages.

public int PageCount { get; set; }

Permissions Property​

Gets the raw PDF permission bits (as returned by the PDF security handler). 0xFFFFFFFF means no restrictions.

public uint Permissions { get; set; }

Version Property​

Gets the PDF version (e.g., "1.7" for PDF 1.7).

public string Version { get; set; }