Click or drag to resize
Pdf Library for .NET

HtmlToPdfViewerPreferences Class

Controls how the generated pdf document is presented when opened in a pdf viewer such as Adobe Reader — which chrome to hide, how to fit and position the window, and the initial page mode and layout. Reached through ViewerPreferences.
Inheritance Hierarchy
SystemObject
  SelectPdf.UniversalHtmlToPdfViewerPreferences

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

The HtmlToPdfViewerPreferences type exposes the following members.

Constructors
Properties
 NameDescription
Public propertyCenterWindow Gets or sets a value indicating whether the viewer centers its window on the screen.
Public propertyDisplayDocTitle Gets or sets a value indicating whether the viewer displays the document title (rather than the file name) in its title bar.
Public propertyFitWindow Gets or sets a value indicating whether the viewer resizes its window to fit the first page.
Public propertyHideMenuBar Gets or sets a value indicating whether the viewer hides its menu bar when the document is opened.
Public propertyHideToolbar Gets or sets a value indicating whether the viewer hides its toolbar when the document is opened.
Public propertyHideWindowUI Gets or sets a value indicating whether the viewer hides its window controls (scrollbars, navigation panels) when the document is opened, leaving only the page content visible.
Public propertyNonFullScreenPageMode Gets or sets the page mode the viewer returns to when the document exits full-screen mode. Defaults to UseNone.
Public propertyPageLayout Gets or sets the page layout the viewer uses when the document is opened (single page, one column, two columns). Defaults to OneColumn.
Public propertyPageMode Gets or sets the page mode the viewer uses when the document is opened (for example, showing the outline or thumbnails panel). Defaults to UseNone.
Top
Example
HtmlToPdf converter = new HtmlToPdf();
converter.Options.ViewerPreferences.HideToolbar = true;
converter.Options.ViewerPreferences.PageMode = PdfViewerPageMode.UseOutlines;
PdfDocument doc = converter.ConvertUrl("https://www.google.com");
doc.Save("out.pdf");
doc.Close();
See Also