public sealed class DocumentViewer : StatefulComponent<DocumentViewerState>
Public NotInheritable Class DocumentViewer
Inherits StatefulComponent(Of DocumentViewerState)
@using GleamTech.AspNet.Mvc
@using GleamTech.DocumentUltimate
@using GleamTech.DocumentUltimate.AspNet
@using GleamTech.DocumentUltimate.AspNet.UI
<!DOCTYPE html>
@{
var documentViewer = new DocumentViewer
{
Width = 800,
Height = 600,
Document = "~/Documents/Document.docx"
};
}
<html>
<head>
<title>Document Viewer</title>
@this.RenderHead(documentViewer)
</head>
<body>
@this.RenderBody(documentViewer)
</body>
</html>
@Imports GleamTech.AspNet.Mvc
@Imports GleamTech.DocumentUltimate
@Imports GleamTech.DocumentUltimate.AspNet
@Imports GleamTech.DocumentUltimate.AspNet.UI
<!DOCTYPE html>
@Code
Dim documentViewer = New DocumentViewer() With {
.Width = 800,
.Height = 600,
.Document = "~/Documents/Document.docx"
}
End Code
<html>
<head>
<title>Document Viewer</title>
@Me.RenderHead(documentViewer)
</head>
<body>
@Me.RenderBody(documentViewer)
</body>
</html>
Note that for ASP.NET Core, you also need to add and register GleamTech in Startup.cs, please see Using DocumentUltimate in an ASP.NET Core project.
DocumentViewer | Initializes a new instance of the DocumentViewer class. |
DocumentViewer(DocumentUltimateWebConfiguration) | Initializes a new instance of the DocumentViewer class with custom web configuration. |
AllowedPermissions |
Gets or sets a value that specifies the allowed permissions for the document viewer.
The default is All.
DeniedPermissions take precedence over AllowedPermissions. For instance, when AllowedPermissions is set to All and DeniedPermissions is set to Download and Print, all permissions except Download and Print will be allowed. When combining permissions, they should be separated by comma in string and by bitwise 'or' operator in code (| in C# and OR in VB). |
ClientEvents | Gets or sets the client-side event handlers. |
CursorTool | Gets or sets a value that specifies the initial cursor tool in the document viewer. The default is Select. |
DebugMode |
Gets or sets a value indicating whether to display detailed error messages for troubleshooting.
Exceptions will be displayed with stack trace, inner exceptions and data.
(Inherited from StatefulComponent) |
DeniedPermissions |
Gets or sets a value that specifies the denied permissions for the document viewer.
The default is None.
DeniedPermissions take precedence over AllowedPermissions. For instance, when AllowedPermissions is set to All and DeniedPermissions is set to Download and Print, all permissions except Download and Print will be allowed. When combining permissions, they should be separated by comma in string and by bitwise 'or' operator in code (| in C# and OR in VB). |
DisplayLanguage |
Gets or sets the display (user interface) language of the document viewer.
It is usually set as the two-letter language names like en, de, fr etc. as the bundled languages are usually for general language names. However, it can be also set to specific cultures like en-US, de-DE, fr-FR etc. For example, if the property is set to a specific culture like de-CH (German in Switzerland), the component will first look for the language file translation-de-CH.json and if the file is not found, it will load the general (fallback) language file of that culture which is translation-de.json. If not set, the language file which matches the current UICulture of the host application will be loaded. If there is no language file which matches the current UICulture or its fallback, then the default language file translation-en.json is loaded. |
DisplayMode | Gets or sets a value indicating whether the component is rendered as InPlace (default), Panel, Window or Viewport. (Inherited from Component) |
Document |
Gets or sets the document to load and display in the document viewer.
This property can be set to:
The document viewer only needs a readable file provider as it only calls GetInfo and OpenRead. |
DocumentOptions |
Gets or sets the options for the document loaded in the document viewer.
You can specify document format, password, watermarks, attachments etc. |
FormatLanguage |
Gets or sets the format language of the document viewer.
Format language is used for the number and date/time formats. It is usually set as the specific cultures like en-US, de-DE, fr-FR etc. If not set, the current Culture of the host application will be used. |
Height | Gets or sets the height of the component. (Inherited from Component) |
Hidden |
Gets or sets a value indicating whether the component is displayed when page is loaded.
When set to false, the component can be displayed later on client-side manually.
For example, the component can be displayed via a button's click event.
(Inherited from Component) |
Id |
Gets or sets the HTML id of the component.
Also a javascript variable with the same name is automatically defined and it can be used to access
the client-side implementation of the component.
If omitted, Id will be automatically set to the class name of this component (e.g camel-case className)
and if there are other instances on the same page, to className2 ... classNameX.
(Inherited from Component) |
LoadingMessage |
Gets or sets a value that specifies the message displayed while the document is being prepared
for the first-time viewing. For example, you can override the default message for localization purpose.
Obsolete. |
MobileMode |
Gets or sets a value that specifies on which mobile device type to use large UI sizing for the document viewer.
Note that device features are not detected, instead browser's viewport size is used to decide the UI sizing. So if you manually resize the browser window (or emulate a device via browser's F12 dev tools), phone or tablet size can be triggered. The default is OnAny which means phones and tablets. |
PageFitMode |
Gets or sets a value that specifies the initial mode for fitting pages in the document viewer.
The default is FitWidth.
Obsolete. |
PageLayoutMode |
Gets or sets a value that specifies the initial mode for placing pages in the document viewer.
The default is Continuous.
Obsolete. |
PageRotationMode |
Gets or sets a value that specifies whether rotate buttons should only rotate all pages or only the currently viewed page.
The default is AllPages.
Obsolete. |
PageZoomLevel |
Gets or sets a value in percentage that specifies the initial zoom level in the document viewer.
The default is 100.
For this property to be effective PageFitMode property should be set to Zoom. Obsolete. |
PanelOptions | Gets or sets the panel options used for Panel mode. (Inherited from Component) |
PrintOptions |
Gets or sets the print options of the document viewer.
The options will be reflected as default values on the print dialog of the document viewer. |
ProductInfoRendered | Gets or sets a value indicating whether product info/copyright comment is rendered in html. (Inherited from Component) |
RememberViewHistory |
Gets or sets a value that specifies whether for each document fingerprint, the document viewer should remember UI state via browser's local storage,
i.e. last viewed page, zoom level, scroll position, rotation, SidebarView, ScrollMode, SpreadMode.
The default is .
If you want the document viewer to discard any view history entries and always load all documents at the first page (and with default zoom values), then you should set this property to . |
Resizable |
Gets or sets a value that specifies if the component can be resized when the user drags sides.
(Inherited from Component) |
ResizeHandles |
Gets or sets a value that specifies the handles which can be used for resizing the component.
Default is South, East and SouthEast.
When using Window mode, set ResizeHandles
which overrides this property.
(Inherited from Component) |
RotationMode | Gets or sets a value that specifies whether rotate buttons should only rotate all pages or only the currently viewed page. The default is AllPages. |
ScrollMode |
Gets or sets a value that specifies the initial mode for scrolling pages in the document viewer.
The default is History.
Note that if RememberViewHistory is set to , then History will be treated as Vertical or derived from 'PageLayout' setting inside PDF if exists. |
SearchOptions |
Gets or sets the text search options of the document viewer.
If you specify a search term, an automatic search will be done when the document is displayed, i.e. the specified term will be searched and results with clickable positions will be listed on the left pane and the term will be highlighted in the pages. For example, if you launch the document viewer from a search results page, you can pass the same search term to the document viewer. |
SidebarView |
Gets or sets a value that specifies the initial active view in sidebar of the document viewer.
The default is History.
Note that if RememberViewHistory is set to , then History will be treated as None or derived from 'PageMode' setting inside PDF if exists. |
SidebarVisible | Gets or sets a value that specifies whether the left sidebar is visible. The default is . |
SidePaneTabsAtBottom |
Gets or sets a value that specifies whether the top tabs of the left side pane should be placed at the bottom instead.
The default is .
Obsolete. |
SidePaneVisible |
Gets or sets a value that specifies whether the left side pane is visible.
The default is .
Obsolete. |
SpreadMode |
Gets or sets a value that specifies the initial mode for spreading pages in the document viewer.
The default is History.
Note that if RememberViewHistory is set to , then History will be treated as None or derived from 'PageLayout' setting inside PDF if exists. |
StateId |
Gets or sets the state id of the component.
This is determined automatically when state is saved to session.
(Inherited from StatefulComponent) |
Theme |
Gets or sets the theme to use for the document viewer.
Possible values are "slate", "classic-light", "classic-dark" or the CSS class name of a custom theme. When two values separated by comma is set, the second value will be the dark theme. Dark theme is used when a user indicates their preference through an operating system setting (e.g. light or dark mode) or a user agent setting. When single value is provided, dark theme is disabled, i.e. the only provided theme will be used always even when user prefers dark mode. The default is "slate, classic-dark". |
ToolbarAtBottom | Gets or sets a value that specifies whether the top toolbar should be placed at the bottom instead. The default is . |
ToolbarVisible | Gets or sets a value that specifies whether the top toolbar is visible. The default is . |
Translations |
Gets or sets a value that specifies the custom translations for the document viewer.
The document viewer has about 111 language files, however for some few custom text which are not inside those language files, this property is used to override. For example, you can override the default "preparing document..." message for localization purpose. |
VerticalToolbarVisible | Gets or sets a value that specifies whether the right vertical toolbar is visible. The default is . |
Width | Gets or sets the width of the component. (Inherited from Component) |
WindowOptions | Gets or sets the windows options used for Window mode. (Inherited from Component) |
ZoomLevel | Gets or sets a value in percentage that specifies the initial zoom level in the document viewer. The default is unset (zero) which means ZoomMode will be used instead. |
ZoomMode |
Gets or sets a value that specifies the initial mode for zooming pages in the document viewer.
The default is History.
Note that if a custom zoom level is set via ZoomLevel property then it will override this setting. |