Table of Contents

Class PdfViewerPreferences

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

Defines the way the document is to be presented on the screen or in print.

public class PdfViewerPreferences
Inheritance
PdfViewerPreferences
Inherited Members

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.PageMode = PdfPageMode.UseAttachments;
doc.ViewerPreferences.PageScaling = PageScalingMode.None;
doc.ViewerPreferences.FitWindow = true;
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage;
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(true);
'Create a new document.
Dim doc As New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference
doc.ViewerPreferences.PageMode = PdfPageMode.UseAttachments
doc.ViewerPreferences.PageScaling = PageScalingMode.None
doc.ViewerPreferences.FitWindow = True
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)

Properties

CenterWindow

A flag specifying whether to position the document�s window in the center of the screen.

public bool CenterWindow { get; set; }

Property Value

bool

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.CenterWindow = true; 
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage;
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(true);
'Create a new document.
Dim doc As New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.CenterWindow = True
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

DisplayTitle

A flag specifying whether the window�s title bar should display the document title taken from the Title entry of the document information dictionary. If false, the title bar should instead display the name of the PDF file containing the document.

public bool DisplayTitle { get; set; }

Property Value

bool

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.CenterWindow = true; 
doc.ViewerPreferences.DisplayTitle = true;    
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(true);
'Create a new document.
Dim doc As New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.CenterWindow = True
doc.ViewerPreferences.DisplayTitle = True
'Save and close the document
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

Duplex

Gets or sets print duplex mode handling option to use when printing the file from the print dialog.

public DuplexMode Duplex { get; set; }

Property Value

DuplexMode

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.     
doc.ViewerPreferences.Duplex = DuplexMode.DuplexFlipShortEdge;
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(True)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.Duplex = DuplexMode.DuplexFlipShortEdge
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

FitWindow

A flag specifying whether to resize the document�s window to fit the size of the first displayed page.

public bool FitWindow { get; set; }

Property Value

bool

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.FitWindow = true;
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage;
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(true);
'Create a new document.
Dim doc As New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.FitWindow = True
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

HideMenubar

A flag specifying whether to hide the viewer application�s menu bar when the document is active.

public bool HideMenubar { get; set; }

Property Value

bool

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Create a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.HideMenubar = true;           
//Save and close the document.
doc.Save("ViewerPreferences.pdf");    
doc.Close(true)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.HideMenubar = True
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

HideToolbar

A flag specifying whether to hide the viewer application�s tool bars when the document is active.

public bool HideToolbar { get; set; }

Property Value

bool

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.HideToolbar = true;           
//Save and close the document.
doc.Save("ViewerPreferences.pdf");  
doc.Close(true)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.HideToolbar = True
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

HideWindowUI

A flag specifying whether to hide user interface elements in the document�s window (such as scroll bars and navigation controls), leaving only the document�s contents displayed.

public bool HideWindowUI { get; set; }

Property Value

bool

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.HideWindowUI = true;           
//Save and close the document.
doc.Save("ViewerPreferences.pdf");  
doc.Close(true)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.HideWindowUI = True
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

PageLayout

A name object specifying the page layout to be used when the document is opened.

public PdfPageLayout PageLayout { get; set; }

Property Value

PdfPageLayout

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.     
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage;
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(True)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.PageLayout = PdfPageLayout.SinglePage
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

PageMode

A name object specifying how the document should be displayed when opened.

public PdfPageMode PageMode { get; set; }

Property Value

PdfPageMode

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.
doc.ViewerPreferences.PageMode = PdfPageMode.UseAttachments;      
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(true)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference
doc.ViewerPreferences.PageMode = PdfPageMode.UseAttachments      
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

PageScaling

Gets or Set the page scaling option to be selected when a print dialog is displayed for this document.

public PageScalingMode PageScaling { get; set; }

Property Value

PageScalingMode

Examples

//Create a new document.
PdfDocument doc = new PdfDocument();
//Creates a new page.
PdfPage page = doc.Pages.Add();
//Set the document`s viewer preference.      
doc.ViewerPreferences.PageScaling = PageScalingMode.None;
//Save and close the document.
doc.Save("ViewerPreferences.pdf");
doc.Close(true)
'Create a new document.
Dim doc As PdfDocument = New PdfDocument()
'Create a new page.
Dim page As PdfPage = doc.Pages.Add()
'Set the document`s viewer preference.
doc.ViewerPreferences.PageScaling = PageScalingMode.None
'Save and close the document.
doc.Save("ViewerPreferences.pdf")
doc.Close(True)
See Also

See Also