Click or drag to resize
Pdf Library for .NET

PdfViewerPreferences Class

Controls how the pdf document appears in a pdf viewer (Adobe Reader, Foxit, etc.) — which panels are visible when the document opens, whether the viewer's chrome is hidden, whether the window resizes to fit the first page, and so on. Obtained via ViewerPreferences; mutations write through to the underlying PDF immediately — no explicit apply step is needed. Works on every document origin: new documents, loaded documents, and HtmlToPdf output.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalPdfViewerPreferences

Namespace: SelectPdf.Universal
Assembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.4
Syntax
public class PdfViewerPreferences

The PdfViewerPreferences type exposes the following members.

Properties
 NameDescription
Public propertyCenterWindow Gets or sets a flag specifying whether to position the document's window in the center of the screen. Default: false.
Public propertyDisplayDocTitle Gets or sets a flag specifying whether the window's title bar should display the document title. Default: false.
Public propertyFitWindow Gets or sets a flag specifying whether to resize the document's window to fit the size of the first displayed page. Default: false.
Public propertyHideMenuBar Gets or sets a flag specifying whether to hide the pdf viewer application's menu bar when the document is active. Default: false.
Public propertyHideToolbar Gets or sets a flag specifying whether to hide the pdf viewer application's tool bars when the document is active. Default: false.
Public propertyHideWindowUI Gets or sets a flag specifying whether to hide user interface elements in the document's window (scroll bars, navigation controls), leaving only the document contents visible. Default: false.
Public propertyNonFullScreenPageMode Gets or sets the document page mode when the pdf viewer application exits full-screen mode. Only meaningful when PageMode is FullScreen. Default: UseNone. Round-trips through get / set but is not currently persisted to the output PDF.
Public propertyPageLayout Gets or sets the page layout to be used when the document is opened. Default: OneColumn.
Public propertyPageMode Gets or sets the page mode (which panel is open) when the pdf document is opened. Default: UseNone.
Top
Example
PdfDocument document = new PdfDocument();
document.AddPage();
document.ViewerPreferences.PageMode = PdfViewerPageMode.UseOutlines;
document.ViewerPreferences.HideToolbar = true;
document.ViewerPreferences.FitWindow = true;
document.Save("out.pdf");
document.Close();
See Also