PdfViewerPreferences Class

The viewer preferences of a document (/ViewerPreferences, ISO 32000-2, 12.2): how viewers show the document and the settings of their print dialog. The dictionary is created when a value is set, and removed when its last entry is.

public sealed class PdfViewerPreferences

Properties

NameDescription
CenterWindowGets or sets a value indicating whether viewers center their window on the screen (/CenterWindow).
DictionaryGets the viewer preferences dictionary of the catalog, or null when the document has none.
DirectionGets or sets the reading order of the text (/Direction), which sets how viewers lay out pages side by side.
DisablePrintScalingGets or sets a value indicating whether the print dialog prints the pages at their size, without scaling them to the paper (/PrintScaling /None).
DisplayDocumentTitleGets or sets a value indicating whether viewers show the title of the document in their title bar instead of the name of the file (/DisplayDocTitle), which PDF/UA requires.
DuplexGets or sets how the print dialog prints the pages on the sides of the sheets (/Duplex).
EnforcedPreferencesGets the names of the preferences viewers must not let the user override (/Enforce, PDF 2.0), such as PrintScaling.
FitWindowGets or sets a value indicating whether viewers resize their window to the first page (/FitWindow).
HideMenubarGets or sets a value indicating whether viewers hide their menu bar (/HideMenubar).
HideToolbarGets or sets a value indicating whether viewers hide their toolbars (/HideToolbar).
HideWindowUIGets or sets a value indicating whether viewers hide the elements of their window, such as the scroll bars, to show only the pages (/HideWindowUI).
NonFullScreenPageModeGets or sets what viewers show when they leave full-screen mode (/NonFullScreenPageMode), when PdfDocument.PageMode is PdfPageMode.FullScreen. The default is PdfPageMode.UseNone.
NumberOfCopiesGets or sets the number of copies the print dialog selects (/NumCopies), from 1 to 5; null to let the print dialog choose.
PickTrayByPdfSizeGets or sets whether the print dialog picks the paper tray from the size of the pages (/PickTrayByPDFSize), or null when the document does not say.
PrintPageRangesGets or sets the pages the print dialog selects (/PrintPageRange): ranges of zero-based page indexes, both ends included; an empty list for all the pages.

Gets or sets a value indicating whether viewers center their window on the screen (/CenterWindow).

public bool CenterWindow { get; set; }

Property value

bool

Gets the viewer preferences dictionary of the catalog, or null when the document has none.

public PdfDictionary? Dictionary { get; }

Property value

PdfDictionary?

Gets or sets the reading order of the text (/Direction), which sets how viewers lay out pages side by side.

public PdfReadingDirection Direction { get; set; }

Property value

PdfReadingDirection

DisablePrintScaling

PdfViewerPreferences.cs

Gets or sets a value indicating whether the print dialog prints the pages at their size, without scaling them to the paper (/PrintScaling /None).

public bool DisablePrintScaling { get; set; }

Property value

bool

DisplayDocumentTitle

PdfViewerPreferences.cs

Gets or sets a value indicating whether viewers show the title of the document in their title bar instead of the name of the file (/DisplayDocTitle), which PDF/UA requires.

public bool DisplayDocumentTitle { get; set; }

Property value

bool

Gets or sets how the print dialog prints the pages on the sides of the sheets (/Duplex).

public PdfDuplexMode Duplex { get; set; }

Property value

PdfDuplexMode

EnforcedPreferences

PdfViewerPreferences.cs

Gets the names of the preferences viewers must not let the user override (/Enforce, PDF 2.0), such as PrintScaling.

public IReadOnlyList<string> EnforcedPreferences { get; }

Property value

IReadOnlyList<string>

Gets or sets a value indicating whether viewers resize their window to the first page (/FitWindow).

public bool FitWindow { get; set; }

Property value

bool

Gets or sets a value indicating whether viewers hide their menu bar (/HideMenubar).

public bool HideMenubar { get; set; }

Property value

bool

Gets or sets a value indicating whether viewers hide their toolbars (/HideToolbar).

public bool HideToolbar { get; set; }

Property value

bool

Gets or sets a value indicating whether viewers hide the elements of their window, such as the scroll bars, to show only the pages (/HideWindowUI).

public bool HideWindowUI { get; set; }

Property value

bool

NonFullScreenPageMode

PdfViewerPreferences.cs

Gets or sets what viewers show when they leave full-screen mode (/NonFullScreenPageMode), when PdfDocument.PageMode is PdfPageMode.FullScreen. The default is PdfPageMode.UseNone.

public PdfPageMode NonFullScreenPageMode { get; set; }

Gets or sets the number of copies the print dialog selects (/NumCopies), from 1 to 5; null to let the print dialog choose.

public int? NumberOfCopies { get; set; }

Property value

int?

Exceptions

ArgumentOutOfRangeException
The value is not between 1 and 5.

PickTrayByPdfSize

PdfViewerPreferences.cs

Gets or sets whether the print dialog picks the paper tray from the size of the pages (/PickTrayByPDFSize), or null when the document does not say.

public bool? PickTrayByPdfSize { get; set; }

Property value

bool?

Gets or sets the pages the print dialog selects (/PrintPageRange): ranges of zero-based page indexes, both ends included; an empty list for all the pages.

public IReadOnlyList<(int First, int Last)> PrintPageRanges { get; set; }

Property value

IReadOnlyList<(int First, int Last)>

Exceptions

ArgumentException
A range is negative or reversed.