Show / Hide Table of Contents

# Class PDFDocViewPrefs

PDFDocViewPrefs is a high-level utility class that can be used to control the way the document is to be presented on the screen or in print.

PDFDocViewPrefs class corresponds to PageMode, PageLayout, and ViewerPreferences entries in the document's catalog. For more details please refer to section 8.1 'Viewer Preferences' in PDF Reference Manual.

##### Inheritance

object
PDFDocViewPrefs

##### Implements

IDisposable

##### Inherited Members

object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

###### Namespace: pdftron.PDF

###### Assembly: PDFTronDotNet.dll

##### Syntax

    public class PDFDocViewPrefs : IDisposable

### Constructors

#### PDFDocViewPrefs()

##### Declaration

    public PDFDocViewPrefs()

#### PDFDocViewPrefs(Obj)

##### Declaration

    public PDFDocViewPrefs(Obj tr)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | tr |

### Methods

#### Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

##### Declaration

    public void Dispose()

#### Dispose(bool)

##### Declaration

    protected virtual void Dispose(bool disposing)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | disposing |

#### ~PDFDocViewPrefs()

Releases all resources used by the PDFDocViewPrefs

##### Declaration

    protected ~PDFDocViewPrefs()

#### GetDirection()

Gets the direction.

##### Declaration

    public bool GetDirection()

##### Returns

Type | Description
--- | ---
bool | true is the predominant reading order for text is left to right, false otherwise. See SetDirection() for more information.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetLayoutMode()

Gets the layout mode.

##### Declaration

    public PDFDocViewPrefs.PageLayout GetLayoutMode()

##### Returns

Type | Description
--- | ---
PDFDocViewPrefs.PageLayout | The value of currently selected PageLayout property.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetNonFullScreenPageMode()

Gets the non full screen page mode.

##### Declaration

    public PDFDocViewPrefs.PageMode GetNonFullScreenPageMode()

##### Returns

Type | Description
--- | ---
PDFDocViewPrefs.PageMode | the PageMode used after exiting full-screen mode.

##### Remarks

This entry is meaningful only if the value of the PageMode is set to e_FullScreen; it is ignored otherwise.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetPageMode()

Gets the page mode.

##### Declaration

    public PDFDocViewPrefs.PageMode GetPageMode()

##### Returns

Type | Description
--- | ---
PDFDocViewPrefs.PageMode | The value of currently selected PageMode property.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetPref(ViewerPref)

Gets the pref.

##### Declaration

    public bool GetPref(PDFDocViewPrefs.ViewerPref pref)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDocViewPrefs.ViewerPref | pref | the ViewerPref property type to query.

##### Returns

Type | Description
--- | ---
bool | the value of given ViewerPref property.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetPrintArea()

Gets the prints the area.

##### Declaration

    public Page.Box GetPrintArea()

##### Returns

Type | Description
--- | ---
Page.Box | the page boundary representing the area of a page to be rendered when printing the document.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetPrintClip()

Gets the prints the clip.

##### Declaration

    public Page.Box GetPrintClip()

##### Returns

Type | Description
--- | ---
Page.Box | the page boundary to which the contents of a page are to be clipped when printing the document.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetSDFObj()

Gets the SDFObj.

##### Declaration

    public Obj GetSDFObj()

##### Returns

Type | Description
--- | ---
Obj | document's SDF/Cos 'ViewerPreferences' dictionary or NULL if the object is not present.

#### GetViewArea()

Gets the view area.

##### Declaration

    public Page.Box GetViewArea()

##### Returns

Type | Description
--- | ---
Page.Box | the page boundary representing the area of a page to be displayed when viewing the document on the screen.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetViewClip()

Gets the view clip.

##### Declaration

    public Page.Box GetViewClip()

##### Returns

Type | Description
--- | ---
Page.Box | the page boundary to which the contents of a page are to be clipped when viewing the document on the screen.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetDirection(bool)

Sets the predominant reading order for text.

This flag has no direct effect on the document's contents or page numbering but can be used to determine the relative positioning of pages when displayed side by side or printed n-up.

##### Declaration

    public void SetDirection(bool left_to_right)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | left_to_right | true if the predominant reading order for text is from left to right and false if it is right to left (including vertical writing systems, such as Chinese, Japanese, and Korean).

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetInitialPage(Destination)

A utility method used to set the fist page displayed after the document is opened. This method is equivalent to `PDFDoc::SetOpenAction(goto_action)`

If OpenAction is not specified the document should be opened to the top of the first page at the default magnification factor.

##### Declaration

    public void SetInitialPage(Destination dest)

##### Parameters

Type | Name | Description
--- | --- | ---
Destination | dest | A value specifying the page destination to be displayed when the document is opened.

##### Examples

    Destination dest = Destination::CreateFit(page);
    pdfdoc.GetViewPrefs().SetInitialPage(dest);

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetLayoutMode(PageLayout)

Sets PageLayout property and change the value of the PageLayout key in the Catalog dictionary.

##### Declaration

    public void SetLayoutMode(PDFDocViewPrefs.PageLayout layout)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDocViewPrefs.PageLayout | layout | the new layout mode

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetNonFullScreenPageMode(PageMode)

Set the document's page mode, specifying how to display the document on exiting full-screen mode.

##### Declaration

    public void SetNonFullScreenPageMode(PDFDocViewPrefs.PageMode mode)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDocViewPrefs.PageMode | mode | PageMode used after exiting full-screen mode. Default value: e_UseNone.

##### Remarks

This entry is meaningful only if the value of the PageMode is set to e_FullScreen; it is ignored otherwise.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetPageMode(PageMode)

Sets PageMode property and change the value of the PageMode key in the Catalog dictionary.

##### Declaration

    public void SetPageMode(PDFDocViewPrefs.PageMode mode)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDocViewPrefs.PageMode | mode | New PageMode setting. Default value is e_UseNone.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetPref(ViewerPref, bool)

Sets the value of given ViewerPref property.

##### Declaration

    public void SetPref(PDFDocViewPrefs.ViewerPref pref, bool value)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDocViewPrefs.ViewerPref | pref | the ViewerPref property type to modifiy.
bool | value | The new value for the property.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetPrintArea(Box)

Sets the page boundary representing the area of a page to be rendered when printing the document.

##### Declaration

    public void SetPrintArea(Page.Box box)

##### Parameters

Type | Name | Description
--- | --- | ---
Page.Box | box | printing region. The default value is page crop-box.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetPrintClip(Box)

Sets the page boundary to which the contents of a page are to be clipped when printing the document.

##### Declaration

    public void SetPrintClip(Page.Box box)

##### Parameters

Type | Name | Description
--- | --- | ---
Page.Box | box | printing clip region. The default value is page crop-box.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetViewArea(Box)

Sets the page boundary representing the area of a page to be displayed when viewing the document on the screen.

##### Declaration

    public void SetViewArea(Page.Box box)

##### Parameters

Type | Name | Description
--- | --- | ---
Page.Box | box | page boundary displayed when viewing the document on the screen. By defualt, PDF viewers will display the crop-box.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### SetViewClip(Box)

Sets the page boundary to which the contents of a page are to be clipped when viewing the document on the screen.

##### Declaration

    public void SetViewClip(Page.Box box)

##### Parameters

Type | Name | Description
--- | --- | ---
Page.Box | box | screen clip region. The default value is page crop-box.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

### Implements

IDisposable