←Select platform

DocumentViewOptions Class

Summary

Optional initial view options to use when a document is set in a document viewer.

Syntax
C#
VB
C++
[SerializableAttribute()] 
[DataContractAttribute()] 
public class DocumentViewOptions 
<SerializableAttribute(),  
 DataContractAttribute()>  
Public Class DocumentViewOptions 
public: 
   [SerializableAttribute,  
   DataContractAttribute] 
   ref class DocumentViewOptions 
Remarks

DocumentViewOptions can be used to set optional initial view options when a document is set in a DocumentViewer.

Documents are set in the viewer using DocumentViewer.SetDocument. During this call, the viewer will check the value of LEADDocument.ViewOptions, and if it contains a valid value (not null) the viewer will try to set up the view initially as indicated by the options in the class as follows:

Member Action
PageNumber If this value is not 0 or 1, the document viewer will try to set the current page number using DocumentViewer.GotoPage.
ViewLayout Runs the corresponding Layout.* command.
AnnotationsUserMode Runs the corresponding Annotations.UserMode* command.
ViewZoomPercent Runs the View.ZoomPercentage command with the specified percentage.
ViewScrollOffset Scrolls the view by the specified amount.
ViewSizeMode Runs the corresponding View.ActualSize, View.FitWidth or View.FitPage command.
ViewItemType Runs the View.ItemType with the specified mode.
LoadAnnotations If true, creates the annotation UI elements and tries to load the annotations stored in the document. If false, the annotation UI elements in the viewer are disabled and hidden.
LoadThumbnails If true, creates the thumbnail UI elements and tries to load the thumbnails of the pages of the document. If false, the thumbnails UI elements in the viewer are disabled and hidden.
LoadBookmarks If true, creates the bookmark UI elements and tries to load the bookmarks stored in the document. If false, the bookmark UI elements in the viewer are disabled and hidden.
ViewCommands Additional user-defined document viewer commands to run.

Refer to Document Viewer Commands for more information on the commands.

In all the operations described above, the document viewer will perform sanity checks on the values before performing the action. For instance, if PageNumber is set to 5 but the document contains only 4 pages, then DocumentViewer.GotoPage is not called and the default page number (1) is viewed instead.

Setting view options in a document can be performed programmatically or interactively using the document viewer demo.

To create or update the view options programmatically on a LEADDocument:

  • Create an instance of DocumentViewOptions
  • Update the values of the class as desired. For instance, set PageNumber to 2 to automatically go to the second page when this document is viewed.
  • Set the instance into the LEADDocument.ViewOptions property.
  • Call LEADDocument.SaveToCache to save the document into the cache using these view options.

Now, when this document is loaded into a DocumentViewer using SetDocument, the view options are parsed and the commands are performed.

To create or update the view options interactively using the document viewer demos:

Now, when this document is loaded into a DocumentViewer using SetDocument, the view options are parsed and the commands are performed.

Requirements
Target Platforms
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.