Class PdfViewerPreferences
Defines the way the document is to be presented on the screen or in print.
Inheritance
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfViewerPreferences : Object, IPdfWrapper
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.
Declaration
public bool CenterWindow { get; set; }
Property Value
Type |
---|
System.Boolean |
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.
Declaration
public bool DisplayTitle { get; set; }
Property Value
Type |
---|
System.Boolean |
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.
Declaration
public DuplexMode Duplex { get; set; }
Property Value
Type |
---|
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)
FitWindow
A flag specifying whether to resize the document�s window to fit the size of the first displayed page.
Declaration
public bool FitWindow { get; set; }
Property Value
Type |
---|
System.Boolean |
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.
Declaration
public bool HideMenubar { get; set; }
Property Value
Type |
---|
System.Boolean |
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.
Declaration
public bool HideToolbar { get; set; }
Property Value
Type |
---|
System.Boolean |
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)
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.
Declaration
public bool HideWindowUI { get; set; }
Property Value
Type |
---|
System.Boolean |
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)
PageLayout
A name object specifying the page layout to be used when the document is opened.
Declaration
public PdfPageLayout PageLayout { get; set; }
Property Value
Type |
---|
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)
PageMode
A name object specifying how the document should be displayed when opened.
Declaration
public PdfPageMode PageMode { get; set; }
Property Value
Type |
---|
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)
PageScaling
Gets or Set the page scaling option to be selected when a print dialog is displayed for this document.
Declaration
public PageScalingMode PageScaling { get; set; }
Property Value
Type |
---|
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)