DocumentViewOptions Object

Summary

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

Syntax
TypeScript
JavaScript
function lt.Document.DocumentViewOptions 
class lt.Document.DocumentViewOptions() 
Remarks

DocumentViewOptions can be used to set optional initial view options to use 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), tries 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 tries 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 annotations UI elements and tries to load the annotations stored in the document. If false, the annotations UI elements in the viewer are disabled and hidden.
loadThumbnails If true creates the thumbnails UI elements and tries to load the thumbnail of the pages of the document. If false, the thumbnails UI elements in the viewer are disabled and hidden.
loadBookmarks If true creates the bookmarks UI elements and tries to load the bookmarks stored in the document. If false, the bookmarks 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 performs sanity check 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 a 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 DocumentFactory.saveToCache to save the document into the cache using this 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 20.0.2019.12.4
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly