Class ViewState
The ViewState holds information about the current UI representation of a specific document.
Inheritance
Namespace: PSPDFKit.UI
Assembly: PSPDFKit.dll
Syntax
public sealed class ViewState
Properties
AllowPrinting
True if printing is allowed. Otherwise false.
Declaration
public bool AllowPrinting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AppearanceStreamTypes
This property defines which annotation types have appearance streams enabled. It only has an effect when set before opening a document. E.g. with ShowDocumentWithViewStateAsync.
If an annotation from an enabled type has an appearance stream, it'll be used when rendering over the default PSPDFKit style.
This only works for appearance streams that already existed when the document was opened.
If an annotation from an enabled type does not have an existing appearance stream, the default PSPDFKit style will be used when rendering.
Note that modifying most annotation properties will invalidate its appearance stream, and it will stop being used.
Moreover, image, stamp, and signature form field annotations will always be rendered using their AP streams.
Declaration
public IEnumerable<AnnotationType> AppearanceStreamTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<AnnotationType> |
CurrentPageIndex
The currently displayed page's index.
Declaration
public int CurrentPageIndex { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
EditableAnnotationTypes
This property defines all annotation types that a user is able to modify. It only has an effect when set before opening a document. E.g. with ShowDocumentWithViewStateAsync. If the set is null or empty the user is allowed to select, create, edit, or delete every annotation type. By allowing only certain annotation types for modification you can be sure that there is no annotation type that gets introduced in the future that your user is then able to modify.
Declaration
public IEnumerable<AnnotationType> EditableAnnotationTypes { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<AnnotationType> |
Examples
This sample shows how to restrict editing to Note and Ink annotations only.
await pdfView.Controller.ShowDocumentWithViewStateAsync(document, new ViewState
{
EditableAnnotationTypes = new HashSet<AnnotationType>
{
AnnotationType.Note,
AnnotationType.Ink,
}
});
ElectronicSignatureOptions
Defines specific configuration options related to the electronic signatures feature.
Changing this property has no effect after a document has loaded. Load the document again if you wish to update it.
Moreover, these options won't come into effect if your license doesn't support the Electronic Signatures component.
Declaration
public SignatureOptions ElectronicSignatureOptions { get; set; }
Property Value
Type | Description |
---|---|
SignatureOptions |
InteractionMode
The current InteractionMode.
Declaration
public InteractionMode InteractionMode { get; set; }
Property Value
Type | Description |
---|---|
InteractionMode |
KeepFirstSpreadAsSinglePage
True if the first page is single in spread mode. Otherwise false.
Declaration
public bool KeepFirstSpreadAsSinglePage { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
KeepSelectedTool
This flag controls whether a selected tool should maintain its selected state after an annotation is created.
Declaration
public bool KeepSelectedTool { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
LayoutMode
The current LayoutMode.
Declaration
public LayoutMode LayoutMode { get; set; }
Property Value
Type | Description |
---|---|
LayoutMode |
Locale
If set, will override the default and use the specified locale in the view. See also SetLocaleAsync(String).
Declaration
public string Locale { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PreventTextCopy
When copying of text is disabled, it's still possible to select text but copying either using the shortcut or a context menu will have no effect. Changing this property has no effect after a document has loaded. Load the document again if you wish to update this property.
Declaration
public bool PreventTextCopy { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ReadOnly
True if the document is currently in UI read only mode. Otherwise false.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ScrollLeft
The position of the horizontal scrollbar in the viewport if applicable from 0.0 to 1.0, left to right.
Declaration
public float ScrollLeft { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
ScrollMode
The current ScrollMode.
Declaration
public ScrollMode ScrollMode { get; set; }
Property Value
Type | Description |
---|---|
ScrollMode |
ScrollTop
The position of the vertical scrollbar in the viewport if applicable from 0.0 to 1.0, top to bottom.
Declaration
public float ScrollTop { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
ShowAnnotations
True if annotations are currently shown. Otherwise false.
Declaration
public bool ShowAnnotations { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
ShowSignatureValidationStatusMode
Controls when the digital signature validation UI will be shown.
Declaration
public ShowSignatureValidationStatusMode ShowSignatureValidationStatusMode { get; set; }
Property Value
Type | Description |
---|---|
ShowSignatureValidationStatusMode |
ShowToolbar
True if the toolbar is currently show. Otherwise false.
Declaration
public bool ShowToolbar { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SidebarMode
The current SidebarMode.
Declaration
public SidebarMode SidebarMode { get; set; }
Property Value
Type | Description |
---|---|
SidebarMode |
SidebarPlacement
The current SidebarPlacement.
Declaration
public SidebarPlacement SidebarPlacement { get; set; }
Property Value
Type | Description |
---|---|
SidebarPlacement |
ZoomFactor
A number multiplier indicating the current zoom factor if ZoomMode is set to ZoomFactor. Otherwise this value is ignored. The maximum zoom level is 10.0 and the minimum is 0.5.
Declaration
public float ZoomFactor { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
ZoomMode
The current ZoomMode. If set to ZoomFactor then the value in ZoomFactor is used to zoom in or out.
Declaration
public ZoomMode ZoomMode { get; set; }
Property Value
Type | Description |
---|---|
ZoomMode |
Methods
Clone()
Declaration
public ViewState Clone()
Returns
Type | Description |
---|---|
ViewState |