Class PdfViewerBase
Represents the methods of PDF Viewer component.
Namespace: Syncfusion.Blazor.SfPdfViewer
Assembly: Syncfusion.Blazor.SfPdfViewer.dll
Syntax
public class PdfViewerBase : SfBaseComponent
Constructors
PdfViewerBase()
Declaration
public PdfViewerBase()
Properties
AjaxRequestSettings
Customize the AJAX request header.
Declaration
[Parameter]
[JsonPropertyName("ajaxRequestSettings")]
public PdfViewerAjaxRequestSettings AjaxRequestSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerAjaxRequestSettings |
Remarks
AjaxRequestSettings is applicable for Web assembly blazor alone.
AnnotationSettings
Defines the annotation settings for PDF Viewer. It used to customize the author, max/min width and height of the annotations.
Declaration
[Parameter]
[JsonPropertyName("annotationSettings")]
public PdfViewerAnnotationSettings AnnotationSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerAnnotationSettings |
AreaSettings
Defines the settings of area annotation. It used to customize the area annotation properties.
Declaration
[Parameter]
[JsonPropertyName("areaSettings")]
public PdfViewerAreaSettings AreaSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerAreaSettings |
ArrowSettings
Defines the settings of arrow annotation. It used to customize the arrow annotation properties.
Declaration
[Parameter]
[JsonPropertyName("arrowSettings")]
public PdfViewerArrowSettings ArrowSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerArrowSettings |
CanRedo
Gets a value that indicates whether the most recent action can be undone.
Declaration
[Parameter]
[JsonPropertyName("canRedo")]
public bool CanRedo { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | false |
Examples
<SfPdfViewer2 CanRedo=true >
</SfPdfViewer2>
CanRedoChanged
Gets or sets a callback that updates the CanRedo bound value.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<bool> CanRedoChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<bool> |
CanUndo
Gets a value indicating whether the user can undo the previous operation in the PDF Viewer control.
Declaration
[Parameter]
[JsonPropertyName("canUndo")]
public bool CanUndo { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | false |
Examples
<SfPdfViewer2 CanUndo=true >
</SfPdfViewer2>
CanUndoChanged
Gets or sets a callback that updates the CanUndo bound value.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<bool> CanUndoChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<bool> |
ChildContent
ChildContent used to define child elements for the root component.
Declaration
[Parameter]
[JsonIgnore]
public RenderFragment ChildContent { get; set; }
Property Value
| Type |
|---|
| RenderFragment |
CircleSettings
Defines the settings of circle annotation. It used to customize circle annotation properties.
Declaration
[Parameter]
[JsonPropertyName("circleSettings")]
public PdfViewerCircleSettings CircleSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerCircleSettings |
CommandManager
Gets or sets the keyboard command manager that defines a set of custom commands and their bindings for the PDF Viewer.
Declaration
[Parameter]
public PdfViewerCommandManager CommandManager { get; set; }
Property Value
| Type |
|---|
| PdfViewerCommandManager |
CommentPanelSettings
Defines the comment panel settings for PDF Viewer. It is used to customize the comment text box, date time format.
Declaration
[Parameter]
[JsonPropertyName("commentPanelSettings")]
public PdfViewerCommentPanelSettings CommentPanelSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerCommentPanelSettings |
CommentPanelVisible
Defines the visibility of the comment panel in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("commentPanelVisible")]
public bool CommentPanelVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | false |
Examples
<SfPdfViewer2 CommentPanelVisible=true >
</SfPdfViewer2>
CommentPanelVisibleChanged
EventCallback to update the CommentPanelVisible value in the parent component.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<bool> CommentPanelVisibleChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<bool> |
ContextMenuSettings
Defines the settings of context menu for the PDF Viewer. It used to customize the context menu options to visibles in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("contextMenuSettings")]
public PdfViewerContextMenuSettings ContextMenuSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerContextMenuSettings |
CssClass
Defines single or multiple classes (separated by space) to be used for customization styles of viewer.
Declaration
[Parameter]
[JsonPropertyName("cssClass")]
public string CssClass { get; set; }
Property Value
| Type |
|---|
| string |
CurrentPageNumber
Gets or sets the current page number of the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("currentPageNumber")]
public int CurrentPageNumber { get; set; }
Property Value
| Type |
|---|
| int |
CurrentPageNumberChanged
Gets the event callback for CurrentPageNumber.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<int> CurrentPageNumberChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<int> |
CurrentPageNumberExpression
Gets the expression for CurrentPageNumber.
Declaration
[Parameter]
[JsonIgnore]
public Expression<Func<int>> CurrentPageNumberExpression { get; set; }
Property Value
| Type |
|---|
| Expression<Func<int>> |
CustomFonts
Sets the Custom fonts path locations for initial loading.
Declaration
[Parameter]
[JsonPropertyName("customFonts")]
public List<string> CustomFonts { get; set; }
Property Value
| Type | Description |
|---|---|
| List<string> | This property contains List of string values |
Remarks
Use this property to add the custom fonts location and cdn link to the pdfium
CustomStampSettings
Defines the settings of customStamp annotation. It use to customize the custom annoation support for the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("customStampSettings")]
public PdfViewerCustomStampSettings CustomStampSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerCustomStampSettings |
DistanceSettings
Defines the settings of distance annotation. It used to customize distance annotation properties.
Declaration
[Parameter]
[JsonPropertyName("distanceSettings")]
public PdfViewerDistanceSettings DistanceSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerDistanceSettings |
DocumentPath
Sets the PDF document path for initial loading.
Declaration
[Parameter]
[JsonPropertyName("documentPath")]
public string DocumentPath { get; set; }
Property Value
| Type |
|---|
| string |
DownloadFileName
Sets the name of the file to be downloaded.
Declaration
[Parameter]
[JsonPropertyName("downloadFileName")]
public string DownloadFileName { get; set; }
Property Value
| Type |
|---|
| string |
EnableAnnotation
If it is set as false, then the annotation support in the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableAnnotation")]
public bool EnableAnnotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableAnnotationToolbar
If it is set as false, then the edit annotation option in the toolbar will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableAnnotationToolbar")]
public bool EnableAnnotationToolbar { get; set; }
Property Value
| Type |
|---|
| bool |
EnableAutoComplete
If it is set as false, auto complete behavior of form fields will be disabled. Be default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableAutoComplete")]
public bool EnableAutoComplete { get; set; }
Property Value
| Type |
|---|
| bool |
EnableBookmarkPanel
If it is set as false, the bookmark panel on the left side of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableBookmark")]
public bool EnableBookmarkPanel { get; set; }
Property Value
| Type |
|---|
| bool |
EnableChunkMessages
Gets or sets a boolean value indicating whether to allow processing large files without increasing the maximum message size of a single incoming hub message (MaximumReceiveMessageSize 32KB). The default value is false.
Declaration
[Parameter]
[JsonPropertyName("enableChunkMessages")]
public bool EnableChunkMessages { get; set; }
Property Value
| Type |
|---|
| bool |
Examples
<SfPdfViewer2 @ref="viewer" EnableChunkMessages="true" Height="100%" Width="100%">
</SfPdfViewer2>
EnableCommentPanel
If it is set as false, then text selection in the PDF Viewer will be disabled, By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableCommentPanel")]
public bool EnableCommentPanel { get; set; }
Property Value
| Type |
|---|
| bool |
EnableDesktopMode
Gets or sets a boolean value to show or hide desktop toolbar in mobile devices. FALSE by default.
Declaration
[Parameter]
[JsonPropertyName("enableDesktopMode")]
public bool EnableDesktopMode { get; set; }
Property Value
| Type |
|---|
| bool |
EnableDownload
If it is set as false, then the download option in the toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableDownload")]
public bool EnableDownload { get; set; }
Property Value
| Type |
|---|
| bool |
EnableErrorDialog
If it is set as false, then error dialogue display in PDF Viewer will be disabled, By default it is true.
Declaration
[Parameter]
[JsonPropertyName("showNotificationDialog")]
public bool EnableErrorDialog { get; set; }
Property Value
| Type |
|---|
| bool |
EnableFormDesigner
Gets or sets a value indicating whether the form designer is enabled in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("enableFormDesigner")]
public bool EnableFormDesigner { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
When enabled, this property allows switching between form design and form filling modes.
Set to true to enable switching between these modes; otherwise, set to false to keep the viewer in form filling mode only.
Examples
EnableFormFields
If it is set as false, form fields in the PDF document can't be interacted or edited. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableFormFields")]
public bool EnableFormFields { get; set; }
Property Value
| Type |
|---|
| bool |
EnableFormFieldsValidation
If it is set as true, validate form fields will be triggered. By default it is false.
Declaration
[Parameter]
[JsonPropertyName("enableFormFieldsValidation")]
public bool EnableFormFieldsValidation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableFreeText
If it is set as false, then the free text annotation tool in the annotation toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableFreeText")]
public bool EnableFreeText { get; set; }
Property Value
| Type |
|---|
| bool |
EnableHandwrittenSignature
if it is set as false, then the handwritten signature tool in the annotation toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableHandwrittenSignature")]
public bool EnableHandwrittenSignature { get; set; }
Property Value
| Type |
|---|
| bool |
EnableHyperlink
If it is set as false, then hyperlink in the PDF Viewer will be disabled, By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableHyperlink")]
public bool EnableHyperlink { get; set; }
Property Value
| Type |
|---|
| bool |
EnableImportAnnotationMeasurement
Enable or disables the customization of measure values in PdfViewer.
Declaration
[Parameter]
[JsonPropertyName("enableImportAnnotationMeasurement")]
public bool EnableImportAnnotationMeasurement { get; set; }
Property Value
| Type |
|---|
| bool |
EnableInkAnnotation
If it is set as false, then the ink annotation support in the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableInkAnnotation")]
public bool EnableInkAnnotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableMagnification
If it is set as false, then all the zoom operations in the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableMagnification")]
public bool EnableMagnification { get; set; }
Property Value
| Type |
|---|
| bool |
EnableMeasureAnnotation
If it is set as false, then the measurement annotation tool in the annotation toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableMeasureAnnotation")]
public bool EnableMeasureAnnotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableNavigation
If it is set as false, then page navigation of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableNavigation")]
public bool EnableNavigation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableNavigationPanel
Gets or sets a value indicating whether the modern navigation panel is enabled in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("enableModernNavigationPanel")]
public bool EnableNavigationPanel { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
When set to true, this property displays the modern navigation panel for enhanced document browsing.
It includes features such as thumbnail previews, bookmark navigation, and improved accessibility tools.
Set to false to disable this panel and use the default navigation interface.
Examples
<SfPdfViewer2
DocumentPath="wwwroot/PDF/test.pdf"
Width="100%"
Height="100%"
EnableNavigationPanel="true" > </SfPdfViewer2>
EnableNavigationToolbar
If it is set as false, then left side toolbar(bookmark, thumbnail navigation toolbar) will not be visible. By default it is true and visible.
Declaration
[Parameter]
[JsonPropertyName("enableNavigationToolbar")]
public bool EnableNavigationToolbar { get; set; }
Property Value
| Type |
|---|
| bool |
EnablePinchZoom
If it is set as false, then pinch zoom of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enablePinchZoom")]
public bool EnablePinchZoom { get; set; }
Property Value
| Type |
|---|
| bool |
EnablePrint
If it is set as false, then the print option in the toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enablePrint")]
public bool EnablePrint { get; set; }
Property Value
| Type |
|---|
| bool |
EnablePrintRotation
If it is set as FALSE, will suppress the page rotation of Landscape document on print action. By default it is TRUE.
Declaration
[Parameter]
[JsonPropertyName("enablePrintRotation")]
public bool EnablePrintRotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableRtl
If it is set as true, then PDF Viewer will render in right to left direction. By default it will render in left to right direction.
Declaration
[Parameter]
[JsonPropertyName("enableRtl")]
public bool EnableRtl { get; set; }
Property Value
| Type |
|---|
| bool |
EnableShapeAnnotation
If it is set as false, then the shape annotation tool in the annotation toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableShapeAnnotation")]
public bool EnableShapeAnnotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableShapeLabel
If it is set as true, label for shape and measure annotations can be added. It used to display the text content about the shape or measure annotation.
Declaration
[Parameter]
[JsonPropertyName("enableShapeLabel")]
public bool EnableShapeLabel { get; set; }
Property Value
| Type |
|---|
| bool |
EnableStampAnnotations
If it is set as false, then the stamp annotation tool in the annotation toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableStampAnnotations")]
public bool EnableStampAnnotations { get; set; }
Property Value
| Type |
|---|
| bool |
EnableStickyNotesAnnotation
If it is set as false, then the sticky notes annotation tool in the toolbar of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableStickyNotesAnnotation")]
public bool EnableStickyNotesAnnotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableTextMarkupAnnotation
If it is set as false, then the textmarkup tools (highlight, strikethrough, squiggly and underline) are disabled in annotation toolbar. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableTextMarkupAnnotation")]
public bool EnableTextMarkupAnnotation { get; set; }
Property Value
| Type |
|---|
| bool |
EnableTextSearch
If it is set as false, then text search support in the PDF Viewer will be disabled, By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableTextSearch")]
public bool EnableTextSearch { get; set; }
Property Value
| Type |
|---|
| bool |
EnableTextSelection
If it is set as false, then text selection in the PDF Viewer will be disabled, By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableTextSelection")]
public bool EnableTextSelection { get; set; }
Property Value
| Type |
|---|
| bool |
EnableThumbnailPanel
If it is set as false, the thumbnail panel on the left side of the PDF Viewer will be disabled. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableThumbnail")]
public bool EnableThumbnailPanel { get; set; }
Property Value
| Type |
|---|
| bool |
EnableToolbar
If it is set as false, then toolbar of the PDF Viewer will not be visible. By default it is true and visible.
Declaration
[Parameter]
[JsonPropertyName("enableToolbar")]
public bool EnableToolbar { get; set; }
Property Value
| Type |
|---|
| bool |
EnableZoomOptimization
If it is set as false, then page image will be fetched for each zoom percentage values. Otherwise, page image will be fetched only when the zoom percentages are 100 %,200 %,300 %, and 400 %. By default it is true.
Declaration
[Parameter]
[JsonPropertyName("enableZoomOptimization")]
public bool EnableZoomOptimization { get; set; }
Property Value
| Type |
|---|
| bool |
ExportAnnotationFileName
Gets or sets the file name of annotations to be exported.
Declaration
[Parameter]
[JsonPropertyName("exportAnnotationFileName")]
public string ExportAnnotationFileName { get; set; }
Property Value
| Type |
|---|
| string |
FallbackFontCollection
It is used to import the custom fonts into PDF Viewer.
Declaration
public Dictionary<string, Stream> FallbackFontCollection { get; }
Property Value
| Type |
|---|
| Dictionary<string, Stream> |
FontFamilies
Defines the list of preferred font families specified by the user.
Declaration
[Parameter]
[JsonPropertyName("fontFamilies")]
public string[] FontFamilies { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] | An array containing the preferred font families. |
Remarks
Use this property to add custom font families to the Font Family dropdown in the Annotation Toolbar and also for the font family dropdown in the Form Designer Properties Dialog. Note: Setting this property will replace the existing font families.
Examples
<SfPdfViewer2 Height="100%" Width="100%" DocumentPath="@DocumentPath" FontFamilies="@FontFamilies">
</SfPdfViewer2>
@code {
private string DocumentPath { get; set; } = "wwwroot/PDF/test.pdf";
private string[] FontFamilies { get; set; } =
{
"Helvetica", "Courier", "Symbol", "Times New Roman",
"Arial Black", "Courier New", "Arial", "Cooper Black"
};
}
FreeTextSettings
Defines the settings of free text annotation. It used to customize the free text annotation properties.
Declaration
[Parameter]
[JsonPropertyName("freeTextSettings")]
public PdfViewerFreeTextSettings FreeTextSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerFreeTextSettings |
HandwrittenSignatureSettings
Defines the settings of handwritten signature annotation. It used to customize the handwritten signature annotation properties.
Declaration
[Parameter]
[JsonPropertyName("handWrittenSignatureSettings")]
public PdfViewerHandwrittenSignatureSettings HandwrittenSignatureSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerHandwrittenSignatureSettings |
Height
Gets or sets the scrollable height of the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("height")]
public string Height { get; set; }
Property Value
| Type |
|---|
| string |
HighlightSettings
Defines the settings of highlight annotation. It used to customize the highlight annotation properties.
Declaration
[Parameter]
[JsonPropertyName("highlightSettings")]
public PdfViewerHighlightSettings HighlightSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerHighlightSettings |
HyperlinkOpenState
Indicates whether the URL is opened in current tab, new tab, new window . By default it is current tab.
Declaration
[Parameter]
[JsonPropertyName("hyperlinkOpenState")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public LinkTarget HyperlinkOpenState { get; set; }
Property Value
| Type |
|---|
| LinkTarget |
ID
Gets or sets the ID for the PDF Viewer parent DOM elemet div.
Declaration
[Parameter]
public string ID { get; set; }
Property Value
| Type |
|---|
| string |
InkAnnotationSettings
Defines the ink annotation settings for PDF Viewer.It used to customize the strokeColor, thickness, opacity of the ink annotation.
Declaration
[Parameter]
[JsonPropertyName("inkAnnotationSettings")]
public PdfViewerInkAnnotationSettings InkAnnotationSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerInkAnnotationSettings |
InteractionMode
Indicates whether the interaction is in selection(select tool) or pan mode. By default it it selection.
Declaration
[Parameter]
[JsonPropertyName("interactionMode")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public InteractionMode InteractionMode { get; set; }
Property Value
| Type |
|---|
| InteractionMode |
IsAnnotationToolbarVisible
Gets the boolean value to identify whether the annotation Toolbar is visible or not. FALSE by default.
Declaration
public bool IsAnnotationToolbarVisible { get; }
Property Value
| Type |
|---|
| bool |
IsDesignerMode
Gets or sets a value indicating whether the designer mode is active in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("formDesignerInteraction")]
public bool IsDesignerMode { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Remarks
When enabled, this property allows interaction with form field design elements.
Set to true to enable editing and manipulation of form fields; otherwise, set to false to disable design interactions.
Examples
IsDesignerModeChanged
Gets or sets the callback that is triggered when the designer mode state changes in the PDF Viewer.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<bool> IsDesignerModeChanged { get; set; }
Property Value
| Type | Description |
|---|---|
| EventCallback<bool> | An EventCallback<TValue> that is invoked when the designer mode state changes.
The parameter indicates whether the designer mode is enabled ( |
Remarks
This event occurs whenever the designer mode is enabled or disabled in the SfPdfViewer2 component. It enables developers to implement custom logic in response to the mode change, such as updating UI elements, logging events, or modifying interactions.
Examples
The following example demonstrates how to handle the IsDesignerModeChanged event:
@code {
void OnIsDesignerModeChanged(bool isDesignerModeEnabled)
{
// Handle the designer mode change event
Console.WriteLine($"Designer Mode Enabled: {isDesignerModeEnabled}");
}
}
IsDocumentEdited
Gets the value to check whether the document has been edited or not. By default it is false. If the document edited, it returns true.
Declaration
[Parameter]
[JsonPropertyName("isDocumentEdited")]
public bool IsDocumentEdited { get; set; }
Property Value
| Type |
|---|
| bool |
IsExtractText
If it is set as true, the PDF Viewer will extract the text from the document asynchronously after the initial loading. Once the extraction process completed then ExtractTextCompleted event will be triggered. The extracted text can be accessed from event args of the ExtractTextCompleted event. By default it is false and text won't be extracted.
Declaration
[Parameter]
[JsonPropertyName("isExtractText")]
public bool IsExtractText { get; set; }
Property Value
| Type |
|---|
| bool |
IsFormFieldDocument
Gets the value to check whether the loaded document have the form fields or not. By default it is false. If the document contains any form field it returns true.
Declaration
[Parameter]
[JsonPropertyName("isFormFieldDocument")]
public bool IsFormFieldDocument { get; set; }
Property Value
| Type |
|---|
| bool |
IsSignatureEditable
If it is set as true, the signature included in the PDF Viewer will saved as ink annotation on download action in the PDF Viewer. Otherwise the signature will be flattened on downloading or saving. By default it is false.
Declaration
[Parameter]
[JsonPropertyName("isSignatureEditable")]
public bool IsSignatureEditable { get; set; }
Property Value
| Type |
|---|
| bool |
IsThumbnailPanelOpen
Indicates whether the thumbnail panel is in expanded or collapsed state. If it set as true, then the thumbnail panel will be expanded or open state . By default it is false.
Declaration
[Parameter]
[JsonPropertyName("isThumbnailViewOpen")]
public bool IsThumbnailPanelOpen { get; set; }
Property Value
| Type |
|---|
| bool |
LineSettings
Defines the settings of line annotation. It used to customize the line annotation properties.
Declaration
[Parameter]
[JsonPropertyName("lineSettings")]
public PdfViewerLineSettings LineSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerLineSettings |
Locale
Overrides the global culture and localization value for this component. Default global culture is 'en-US'.
Declaration
[Parameter]
[JsonPropertyName("locale")]
public string Locale { get; set; }
Property Value
| Type |
|---|
| string |
MaxZoomValue
Gets or sets the Maximum Zoom value of the PDF Viewer. It's default value 400.
Declaration
[Parameter]
[JsonPropertyName("maxZoomValue")]
public int MaxZoomValue { get; set; }
Property Value
| Type |
|---|
| int |
MeasurementSettings
Defines the settings of measurement annotation. It used to customize the measurement annotation properties.
Declaration
[Parameter]
[JsonPropertyName("measurementSettings")]
public PdfViewerMeasurementSettings MeasurementSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerMeasurementSettings |
MinZoomValue
Gets or sets the Minimum Zoom value of the PDF Viewer. It's default value 10.
Declaration
[Parameter]
[JsonPropertyName("minZoomValue")]
public int MinZoomValue { get; set; }
Property Value
| Type |
|---|
| int |
NavigationToolbarSettings
Provides configuration options for customizing the navigation toolbar in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("navigationToolbarSettings")]
public NavigationToolbarSettings? NavigationToolbarSettings { get; set; }
Property Value
| Type |
|---|
| NavigationToolbarSettings |
Remarks
The NavigationToolbarSettings element enables developers to define the toolbar layout and behavior
by specifying the built-in navigation items and injecting custom toolbar items.
It enhances navigation flexibility and allows integration of additional actions tailored to user needs.
Examples
OverscanCount
Gets or sets the number of pages that should be preloaded in the PDF Viewer to enhance scrolling experience.
Declaration
[Parameter]
[JsonPropertyName("overscanCount")]
public int OverscanCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The number of pages to preload. A higher value can improve scrolling performance but may increase memory usage. |
Remarks
Setting this property allows the PDF Viewer to preload the specified number of pages, which can provide a smoother scrolling experience for the user. Setting higher value to this property will increase main memory usage. So, adjust the value based on the performance and memory considerations of your application.
PageCount
Gets the total page count of the loaded PDF document.
Declaration
[Parameter]
[JsonPropertyName("pageCount")]
public int PageCount { get; set; }
Property Value
| Type |
|---|
| int |
PageCountChanged
Gets the event callback for PageCount.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<int> PageCountChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<int> |
PageCountExpression
Gets the expression for PageCount.
Declaration
[Parameter]
[JsonIgnore]
public Expression<Func<int>> PageCountExpression { get; set; }
Property Value
| Type |
|---|
| Expression<Func<int>> |
PerimeterSettings
Defines the settings of perimeter annotation. It used to customize the perimeter annotation properties.
Declaration
[Parameter]
[JsonPropertyName("perimeterSettings")]
public PdfViewerPerimeterSettings PerimeterSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerPerimeterSettings |
PolygonSettings
Defines the settings of polygon annotation. It used to customize the polygon annotation properties.
Declaration
[Parameter]
[JsonPropertyName("polygonSettings")]
public PdfViewerPolygonSettings PolygonSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerPolygonSettings |
PrintMode
Specifies the print mode in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("printMode")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public PrintMode PrintMode { get; set; }
Property Value
| Type |
|---|
| PrintMode |
PrintScaleFactor
Specifies the document printing quality.
Declaration
[Parameter]
[JsonPropertyName("printScaleFactor")]
public double PrintScaleFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| double | The default value of the print scale factor is 1.0, which means that the document will be printed at its actual scale on screen. |
Remarks
The default printing quality is set to 1.0. This limit varies from 0.5 to 5.0. If an invalid value is specified, the default value of 1.0 will be used. For documents with smaller page dimensions, a higher print quality is recommended.
Examples
The following code sets the print scale factor to 2:
public void ChangePrintScaleFactor()
{
printScaleFactor = 2;
}
RadiusSettings
Defines the settings of radius annotation. It used to customize the radius annotation properties.
Declaration
[Parameter]
[JsonPropertyName("radiusSettings")]
public PdfViewerRadiusSettings RadiusSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerRadiusSettings |
RectangleSettings
Defines the settings of rectangle annotation. It used to customize the rectangle annotation properties.
Declaration
[Parameter]
[JsonPropertyName("rectangleSettings")]
public PdfViewerRectangleSettings RectangleSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerRectangleSettings |
RestrictZoomRequest
Gets or sets a value indicating whether a single image rendered at 100% zoom should be reused across all zoom levels.
Declaration
[Parameter]
[JsonPropertyName("restrictZoomRequest")]
public bool RestrictZoomRequest { get; set; }
Property Value
| Type |
|---|
| bool |
Remarks
The RestrictZoomRequest property helps optimize zoom performance in the PDF viewer by reducing the frequency of image regeneration.
When enabled (true), the viewer generates a single image at 100% zoom and reuses it for all subsequent zoom operations. This minimizes client-side
processing and enhances performance, particularly on low-powered or resource-constrained devices. However, it may slightly reduce image clarity at non-100% zoom levels.
When disabled (false, default), page images are regenerated at each zoom level to ensure sharper rendering during zoom interactions.
Examples
The following example demonstrates how to enable the RestrictZoomRequest property in the Blazor SfPdfViewer component:
RetryCount
Gets or sets the retry count for PDF Viewer service call. By default retrycount is 1.
Declaration
[Parameter]
[JsonPropertyName("retryCount")]
public double RetryCount { get; set; }
Property Value
| Type |
|---|
| double |
Remarks
This RetryCount is only applicable for Web Assembly projects alone.
ScrollSettings
Define the tile rendering settings. Tile rendering will render the PDF pages into mutiple tiles.
Declaration
[Parameter]
[JsonPropertyName("scrollSettings")]
public PdfViewerScrollSettings ScrollSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerScrollSettings |
ServerActionSettings
Defines the settings of the PdfViewer service. It is used to map the server action method name for service calls.
Declaration
[Parameter]
[JsonPropertyName("serverActionSettings")]
public PdfViewerServerActionSettings ServerActionSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerServerActionSettings |
Remarks
This ServerActionSettings is applicable for web assembly project alone.
ShapeLabelSettings
Provide option to customize the label text for shape and measure annotations. It is applicable only if set EnableShapeLabel is true.
Declaration
[Parameter]
[JsonPropertyName("shapeLabelSettings")]
public PdfViewerShapeLabelSettings ShapeLabelSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerShapeLabelSettings |
ShowDigitalSignatureAppearance
Gets or sets a value that indicates whether to show the digital signature appearance in the document.
Declaration
[Parameter]
[JsonPropertyName("showDigitalSignatureAppearance")]
public bool ShowDigitalSignatureAppearance { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | true |
Examples
<SfPdfViewer2 ShowDigitalSignatureAppearance=true >
</SfPdfViewer2>
SquigglySettings
Defines the settings of squiggly annotation. It used to customize the squiggly annotation properties.
Declaration
[Parameter]
[JsonPropertyName("squigglySettings")]
public PdfViewerSquigglySettings SquigglySettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerSquigglySettings |
StampSettings
Defines the settings of stamp annotation.It is used to customize the stamp annoations settings, stamp menu items to be visible in annotation toolbar.
Declaration
[Parameter]
[JsonPropertyName("stampSettings")]
public PdfViewerStampSettings StampSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerStampSettings |
StickyNotesSettings
Defines the settings of stickyNotes annotation.
Declaration
[Parameter]
[JsonPropertyName("stickyNotesSettings")]
public PdfViewerStickyNotesSettings StickyNotesSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerStickyNotesSettings |
StrikethroughSettings
Defines the settings of strikethrough annotation. It used to customize the strikethrough annotation properties.
Declaration
[Parameter]
[JsonPropertyName("strikethroughSettings")]
public PdfViewerStrikethroughSettings StrikethroughSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerStrikethroughSettings |
TextSearchColorSettings
Configure the search text and highlight text color for the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("textSearchColorSettings")]
public PdfViewerTextSearchColorSettings TextSearchColorSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerTextSearchColorSettings |
TileRenderingSettings
Define the tile rendering settings. Tile rendering will render the PDF pages into mutiple tiles.
Declaration
[Parameter]
[JsonPropertyName("tileRenderingSettings")]
public PdfViewerTileRenderingSettings TileRenderingSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerTileRenderingSettings |
ToolbarSettings
Defines the builtin toolbar and annotation toolbar option to be visible in the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("toolbarSettings")]
public PdfViewerToolbarSettings ToolbarSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerToolbarSettings |
UnderlineSettings
Defines the settings of underline annotation. It is used to customize the properties of the underline annotation.
Declaration
[Parameter]
[JsonPropertyName("underlineSettings")]
public PdfViewerUnderlineSettings UnderlineSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerUnderlineSettings |
VolumeSettings
Defines the settings of volumne annotation. It is used to customize the properties of the volume annotation.
Declaration
[Parameter]
[JsonPropertyName("volumeSettings")]
public PdfViewerVolumeSettings VolumeSettings { get; set; }
Property Value
| Type |
|---|
| PdfViewerVolumeSettings |
Width
Gets or sets the scrollable width of the PDF Viewer.
Declaration
[Parameter]
[JsonPropertyName("width")]
public string Width { get; set; }
Property Value
| Type |
|---|
| string |
ZoomMode
Indicates whether the PDF page will be rendered in fit to page, fit to width or based on the zoom percentage value(default) in the PDF Viewer. By default it value is Default and it represent the page rendered based on the zoom percentage.
Declaration
[Parameter]
[JsonPropertyName("zoomMode")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public ZoomMode ZoomMode { get; set; }
Property Value
| Type |
|---|
| ZoomMode |
ZoomValue
Gets or sets the Zoom Percentage value of the PDF Viewer. It's range varies from 10 to 400.
Declaration
[Parameter]
[JsonPropertyName("zoomValue")]
public int ZoomValue { get; set; }
Property Value
| Type |
|---|
| int |
ZoomValueChanged
Gets the event callback for ZoomValue.
Declaration
[Parameter]
[JsonIgnore]
public EventCallback<int> ZoomValueChanged { get; set; }
Property Value
| Type |
|---|
| EventCallback<int> |
ZoomValueExpression
Gets the expression for ZoomValue.
Declaration
[Parameter]
[JsonIgnore]
public Expression<Func<int>> ZoomValueExpression { get; set; }
Property Value
| Type |
|---|
| Expression<Func<int>> |
jsProperty
Declaration
protected virtual string jsProperty { get; set; }
Property Value
| Type |
|---|
| string |
jsRuntime
Declaration
[Inject]
protected IJSRuntime jsRuntime { get; set; }
Property Value
| Type |
|---|
| IJSRuntime |
nameSpace
Declaration
protected virtual string nameSpace { get; set; }
Property Value
| Type |
|---|
| string |
Methods
AddAnnotationAsync(PdfAnnotation)
Adds a PDF annotation to the PDF Viewer.
Declaration
public Task AddAnnotationAsync(PdfAnnotation annotation)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | The PDF annotation to be added. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously adds a specified PDF annotation to the PDF Viewer.
The provided example demonstrates how to create a new annotation of type AnnotationType.Line
and add it to the viewer using the AddAnnotationAsync method.
Examples
public async void AddAnnotation()
{
PdfAnnotation annotation = new PdfAnnotation();
annotation.Type = AnnotationType.Line;
await viewer.AddAnnotationAsync(annotation);
}
AddAnnotationAsync(PdfAnnotation, DynamicStampItem)
Adds a dynamic stamp PDF annotation to the PDF viewer.
Declaration
public Task AddAnnotationAsync(PdfAnnotation annotation, DynamicStampItem dynamicStampItem)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | The PDF annotation to be added. |
| DynamicStampItem | dynamicStampItem | The dynamic stamp item associated with the annotation. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously adds a specified dynamic stamp PDF annotation to the PDF viewer. The provided example demonstrates how to create a new annotation of type AnnotationType.Stamp and associate it with a specific dynamic stamp item using the AddAnnotationAsync method.
Examples
public async void AddAnnotation()
{
PdfAnnotation annotation = new PdfAnnotation();
annotation.Type = AnnotationType.Stamp;
await viewer.AddAnnotationAsync(annotation, DynamicStampItem.Approved);
}
AddAnnotationAsync(PdfAnnotation, SignStampItem)
Adds a sign stamp PDF annotation to the PDF viewer.
Declaration
public Task AddAnnotationAsync(PdfAnnotation annotation, SignStampItem signStampItem)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | The PDF annotation to be added. |
| SignStampItem | signStampItem | The sign stamp item associated with the annotation. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously adds a specified sign stamp PDF annotation to the PDF viewer. The provided example demonstrates how to create a new annotation of type AnnotationType.Stamp and associate it with a specific sign stamp item using the AddAnnotationAsync method.
Examples
public async void AddAnnotation()
{
PdfAnnotation annotation = new PdfAnnotation();
annotation.Type = AnnotationType.Stamp;
await viewer.AddAnnotationAsync(annotation, SignStampItem.Accepted);
}
AddAnnotationAsync(PdfAnnotation, StandardBusinessStampItem)
Adds a standard business stamp PDF annotation to the PDF viewer.
Declaration
public Task AddAnnotationAsync(PdfAnnotation annotation, StandardBusinessStampItem standardBusinessStampItem)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | The PDF annotation to be added. |
| StandardBusinessStampItem | standardBusinessStampItem | The standard business stamp item associated with the annotation. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously adds a specified standard business stamp PDF annotation to the PDF viewer. The provided example demonstrates how to create a new annotation of type AnnotationType.Stamp and associate it with a specific standard business stamp item using the AddAnnotationAsync method.
Examples
public async void AddAnnotation()
{
PdfAnnotation annotation = new PdfAnnotation();
annotation.Type = AnnotationType.Stamp;
await viewer.AddAnnotationAsync(annotation, StandardBusinessStampItem.Approved);
}
AddAnnotationsAsync(List<PdfAnnotation>)
Adds a collection of PDF annotations to the PDF Viewer.
Declaration
public Task AddAnnotationsAsync(List<PdfAnnotation> annotationCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| List<PdfAnnotation> | annotationCollection | The collection of PDF annotations to be added. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous add operation. |
Remarks
This method adds a collection of PDF annotations to the PDF Viewer asynchronously. The provided example demonstrates how to create an annotation collection and add it to the viewer using the AddAnnotationsAsync method.
Examples
public async void AddAnnotations()
{
List<PdfAnnotation> annotations = new List<PdfAnnotation>();
PdfAnnotation annotation = new PdfAnnotation();
annotation.Type = AnnotationType.Line;
annotations.Add(annotation);
PdfAnnotation annotation1 = new PdfAnnotation();
annotation1.Type = AnnotationType.Circle;
annotations.Add(annotation1);
await viewer.AddAnnotationsAsync(annotations);
}
AddAriaLabelValueWithID(string, string)
Adds an aria-label and an id to a dictionary object.
Declaration
public Dictionary<string, object> AddAriaLabelValueWithID(string text, string id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| string | id |
Returns
| Type |
|---|
| Dictionary<string, object> |
AddFormFieldsAsync(List<FormFieldInfo>)
Asynchronously adds a list of form fields in the PDF Viewer.
Declaration
public Task AddFormFieldsAsync(List<FormFieldInfo> formFields)
Parameters
| Type | Name | Description |
|---|---|---|
| List<FormFieldInfo> | formFields |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of adding the specified form fields in the PDF Viewer. |
Remarks
This method allows adding multiple form fields in the PDF Viewer.
It accepts a list of FormFieldInfo objects, enabling batch insertion of form fields.
The following example demonstrates adding form fields using a button.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="AddFormFields">Add Form Fields</button>
@code {
SfPdfViewer2 pdfViewer;
async Task AddFormFields()
{
List<FormFieldInfo> formFields = new List<FormFieldInfo>
{
new TextBoxField() { Name = "TextBox1", PageNumber = 1, Value = "text" },
new CheckBoxField { Name = "CheckBox1", PageNumber = 1, IsChecked = true }
};
await pdfViewer.AddFormFieldsAsync(formFields);
}
}
AddPageRedactionsAsync(List<int>)
Asynchronously adds redaction annotations that cover the entire content of the specified pages in the PDF document.
Declaration
public Task AddPageRedactionsAsync(List<int> PageNumbers)
Parameters
| Type | Name | Description |
|---|---|---|
| List<int> | PageNumbers | A list of page numbers to which redaction annotations will be applied. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
Remarks
This method creates redaction annotations that cover the full area of each specified page in the loaded PDF document.
It executes asynchronously to prevent blocking the main thread during the operation.
Only the pages listed in the PageNumbers parameter will be processed for redaction.
Examples
public async Task RedactSelectedPagesAsync()
{
List<int> pages = new List<int> { 1, 3, 5 };
await viewer.AddPageRedactionsAsync(pages); // Adds redaction to pages 1, 3, and 5
}
CancelTextSearchAsync()
Cancels the text search of the PDF Viewer.
Declaration
public Task CancelTextSearchAsync()
Returns
| Type |
|---|
| Task |
ClearSelectionAsync()
Clear the annotation selection in the PDF Viewer.
Declaration
public Task ClearSelectionAsync()
Returns
| Type |
|---|
| Task |
ClearTextSelectionAsync()
Clear the text selection.
Declaration
public Task ClearTextSelectionAsync()
Returns
| Type |
|---|
| Task |
DeleteAnnotationAsync()
Delete the selected annotation in the PDF Viewer.
Declaration
public Task DeleteAnnotationAsync()
Returns
| Type |
|---|
| Task |
DeleteAnnotationAsync(PdfAnnotation)
Deletes a PDF annotation from the PDF viewer.
Declaration
public Task DeleteAnnotationAsync(PdfAnnotation annotation)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | The PDF annotation to be deleted. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously deletes the specified PDF annotation from the PDF viewer. The example demonstrates how to retrieve a list of annotations, and then delete a specific annotation using DeleteAnnotationAsync.
Examples
public async void DeleteAnnotation()
{
List<PdfAnnotation> pdfAnnotations = await viewer.GetAnnotationsAsync();
await viewer.DeleteAnnotationAsync(pdfAnnotations[0]);
}
DeleteAnnotationAsync(string)
Deletes a PDF annotation by its identifier from the PDF viewer.
Declaration
public Task DeleteAnnotationAsync(string annotationId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | annotationId | The identifier of the annotation to be deleted. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously deletes a PDF annotation identified by the provided annotationId from the PDF viewer. The example illustrates how to retrieve a list of annotations, obtain an annotation's identifier, and then delete that specific annotation using DeleteAnnotationAsync.
Examples
public async void DeleteAnnotation()
{
List<PdfAnnotation> pdfAnnotations = await viewer.GetAnnotationsAsync();
string deleteAnnotationId = pdfAnnotations[0].Id;
await viewer.DeleteAnnotationAsync(deleteAnnotationId);
}
DeleteAnnotationsAsync()
To delete the annotation Collections in the PDF Document.
Declaration
public Task DeleteAnnotationsAsync()
Returns
| Type |
|---|
| Task |
DeleteAnnotationsAsync(List<PdfAnnotation>)
Deletes a collection of PDF annotations from the PDF Viewer.
Declaration
public Task DeleteAnnotationsAsync(List<PdfAnnotation> annotationCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| List<PdfAnnotation> | annotationCollection | The collection of PDF annotations to be deleted. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous delete operation. |
Remarks
This method deletes a collection of PDF annotations from the PDF Viewer asynchronously. The provided example demonstrates how to create an annotation collection and delete it from the viewer using the DeleteAnnotationsAsync method.
Examples
public async void DeleteAnnotations()
{
List<PdfAnnotation> annotationCollection = await viewer.GetAnnotationsAsync();
await viewer.DeleteAnnotationsAsync(annotationCollection);
}
DeleteAnnotationsAsync(List<string>)
Deletes a list of annotations from the PDF document by their IDs.
Declaration
public Task DeleteAnnotationsAsync(List<string> annotationsId)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | annotationsId | A list of string IDs representing the annotations to be deleted. Each ID corresponds to a specific annotation in the PDF document. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous delete operation. |
Remarks
This method deletes a collection of PDF annotations from the PDF Viewer asynchronously by their IDs. The provided example demonstrates how to create a list of annotation IDs and delete the corresponding annotations from the viewer using the DeleteAnnotationsAsync method.
Examples
public async void DeleteAnnotations()
{
List<PdfAnnotation> pdfAnnotations = await viewer.GetAnnotationsAsync();
List<string> annotationsId = new List<string> { pdfAnnotations[0].Id, pdfAnnotations[1].Id, pdfAnnotations[2].Id };
await viewer.DeleteAnnotationsAsync(annotationsId);
}
DeleteFormFieldsAsync(bool)
Asynchronously deletes form fields in the PDF Viewer.
Declaration
public Task DeleteFormFieldsAsync(bool deleteAllFields = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | deleteAllFields | A boolean value indicating whether to delete all form fields.
If |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of deleting form fields from the PDF Viewer. |
Remarks
If deleteAllFields is set to true, all form fields in the PDF Viewer will be deleted.
If it is false or left empty, only the selected form field will be deleted.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="DeleteAllFormFields">Delete All Form Fields</button>
<button @onclick="DeleteSelectedFormField">Delete Selected Form Field</button>
@code {
SfPdfViewer2 pdfViewer;
async Task DeleteAllFormFields()
{
await pdfViewer.DeleteFormFieldsAsync(true);
}
async Task DeleteSelectedFormField()
{
await pdfViewer.DeleteFormFieldsAsync(false);
}
}
DeleteFormFieldsAsync(List<FormFieldInfo>)
Asynchronously deletes specified form fields in the PDF Viewer.
Declaration
public Task DeleteFormFieldsAsync(List<FormFieldInfo> formFields)
Parameters
| Type | Name | Description |
|---|---|---|
| List<FormFieldInfo> | formFields |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of deleting the specified form fields from the PDF Viewer. |
Remarks
This method removes the specified form fields from the PDF Viewer using a list of FormFieldInfo objects.
Ensure that each object corresponds to an existing field before calling this method.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="DeleteFormFields">Delete Form Fields</button>
@code {
SfPdfViewer2 pdfViewer;
async Task DeleteFormFields()
{
List<FormFieldInfo> formFields = await pdfViewer.GetFormFieldsAsync();
await pdfViewer.DeleteFormFieldsAsync(formFields);
}
}
DeleteFormFieldsAsync(List<string>)
Asynchronously deletes specified form fields in the PDF Viewer.
Declaration
public Task DeleteFormFieldsAsync(List<string> formFieldIds)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | formFieldIds |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of deleting the specified form fields from the PDF Viewer. |
Remarks
This method removes the specified form fields from the PDF Viewer.
Ensure that the provided list of field identifiers is valid and corresponds to existing fields.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="DeleteFormFields">Delete Form Fields</button>
@code {
SfPdfViewer2 pdfViewer;
List<string> formFieldIds = new List<string> { "field1", "field2" };
async Task DeleteFormFields()
{
await pdfViewer.DeleteFormFieldsAsync(formFieldIds);
}
}
Dispose()
Dispose the PDF Viewer and it's dependencies.
Declaration
public override void Dispose()
Dispose(bool)
Dispose the unmanaged resources from PDF Viewer component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
DownloadAsync()
Downloads the PDF document being loaded in the PDF Viewer.
Declaration
public Task DownloadAsync()
Returns
| Type |
|---|
| Task |
EditAnnotationAsync(PdfAnnotation)
Edits a PDF annotation in the PDF Viewer.
Declaration
public Task EditAnnotationAsync(PdfAnnotation annotation)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | The PDF annotation to be edited. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the operation. |
Remarks
This method asynchronously edits a specified PDF annotation in the PDF Viewer.
The provided example demonstrates how to edit the existing annotation's opacity value
and apply the changes to the viewer using the EditAnnotationAsync method.
Examples
public async void EditAnnotation()
{
List <PdfAnnotation> pdfAnnotations = await viewer.GetAnnotationsAsync();
// Modify the properties of the annotation (e.g., opacity).
pdfAnnotations[0].Opacity = 0.5; // Assuming that opacity is a value between 0 and 1.
await viewer.EditAnnotationAsync(pdfAnnotations[0]);
}
EnableToolbarItemsAsync(List<ToolbarItem>, bool)
Enables or disables the the toolbar items in the PDF Viewer.
Declaration
public Task EnableToolbarItemsAsync(List<ToolbarItem> items, bool isEnable)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ToolbarItem> | items | |
| bool | isEnable |
Returns
| Type |
|---|
| Task |
ExportAnnotationAsStreamAsync(AnnotationDataFormat)
Perform export annotations as Stream in the PDF Viewer.
Declaration
public Task<Stream> ExportAnnotationAsStreamAsync(AnnotationDataFormat annotationDataFormat = AnnotationDataFormat.Json)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationDataFormat | annotationDataFormat |
Returns
| Type |
|---|
| Task<Stream> |
ExportAnnotationAsync(AnnotationDataFormat)
Perform export annotations action in the PDF Viewer.
Declaration
public Task ExportAnnotationAsync(AnnotationDataFormat annotationDataFormat = AnnotationDataFormat.Json)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationDataFormat | annotationDataFormat |
Returns
| Type |
|---|
| Task |
ExportAnnotationsAsObjectAsync()
Perform export annotations action in the PDF Viewer.
Declaration
public Task<object> ExportAnnotationsAsObjectAsync()
Returns
| Type |
|---|
| Task<object> |
ExportFormFieldsAsObjectAsync()
Perform export annotations action in the PDF Viewer.
Declaration
public Task<Dictionary<string, string>> ExportFormFieldsAsObjectAsync()
Returns
| Type |
|---|
| Task<Dictionary<string, string>> |
ExportFormFieldsAsync(FormFieldDataFormat)
Exports the form fields data as stream.
Declaration
public Task<Stream> ExportFormFieldsAsync(FormFieldDataFormat formattype = FormFieldDataFormat.Json)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFieldDataFormat | formattype | Represents the form fields data format. |
Returns
| Type | Description |
|---|---|
| Task<Stream> | Returns the stream instance which contains the form data. |
ExportFormFieldsAsync(string)
Perform export action in the PDF Viewer.
Declaration
public Task ExportFormFieldsAsync(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path |
Returns
| Type |
|---|
| Task |
FitToHeightAsync()
Scales the page to fit the page width within container height of the PDF Viewer.
Declaration
public Task FitToHeightAsync()
Returns
| Type |
|---|
| Task |
FitToPageAsync()
Scales the page to fit with in the container of the PDF Viewer.
Declaration
public Task FitToPageAsync()
Returns
| Type |
|---|
| Task |
FitToWidthAsync()
Scales the page to fit the page width within container width of the PDF Viewer.
Declaration
public Task FitToWidthAsync()
Returns
| Type |
|---|
| Task |
GetAnnotationsAsync()
Gets the annotations collection.
Declaration
public Task<List<PdfAnnotation>> GetAnnotationsAsync()
Returns
| Type |
|---|
| Task<List<PdfAnnotation>> |
GetAriaLabelValue(string)
Creates a dictionary containing an "aria-label" entry.
Declaration
public Dictionary<string, object> GetAriaLabelValue(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text |
Returns
| Type |
|---|
| Dictionary<string, object> |
GetAriaLabelValue(string, bool)
Creates a dictionary containing an "aria-label" entry and a "tabIndex" entry.
Declaration
public Dictionary<string, object> GetAriaLabelValue(string text, bool enabledState)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| bool | enabledState |
Returns
| Type |
|---|
| Dictionary<string, object> |
GetAriaLabelValue(string, string)
Creates a dictionary containing accessibility attributes such as "aria-label" and a custom "label".
Declaration
public Dictionary<string, object> GetAriaLabelValue(string text, string label)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | |
| string | label |
Returns
| Type |
|---|
| Dictionary<string, object> |
GetBookmarksAsync()
Get bookmarks of the PDF document being loaded in the PDF Viewer.
Declaration
public Task<List<Bookmark>> GetBookmarksAsync()
Returns
| Type |
|---|
| Task<List<Bookmark>> |
GetDocumentAsync()
Gets the loaded PDF document with the changes.
Declaration
public Task<byte[]> GetDocumentAsync()
Returns
| Type |
|---|
| Task<byte[]> |
GetFormFieldsAsync()
Asynchronously retrieves form fields from the PDF Viewer.
Declaration
public Task<List<FormFieldInfo>> GetFormFieldsAsync()
Returns
| Type | Description |
|---|---|
| Task<List<FormFieldInfo>> | A Task that represents the asynchronous operation. |
Remarks
This method returns a list of FormFieldInfo objects representing the form fields present in the document. It can be used to inspect or manipulate the form fields.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="GetFormFields">Get Form Fields</button>
@code {
SfPdfViewer2 pdfViewer;
async Task GetFormFields()
{
List<FormFieldInfo> formFields = await pdfViewer.GetFormFieldsAsync();
}
}
GetMainComponentPlatform()
Returns PDFViewer platform for main component
Declaration
protected override Platform? GetMainComponentPlatform()
Returns
| Type |
|---|
| Platform |
GetPageCountAsync()
Returns the page count of the document loaded in the PdfViewer control.
Declaration
public Task<int> GetPageCountAsync()
Returns
| Type |
|---|
| Task<int> |
GetZoomPercentageAsync()
Returns the current zoom percentage of the PdfViewer control.
Declaration
public Task<int> GetZoomPercentageAsync()
Returns
| Type |
|---|
| Task<int> |
GoToBookmarkAsync(int, double)
Navigate To current Bookmark location of the PDF document being loaded in the PDF Viewer.
Declaration
public Task GoToBookmarkAsync(int pageNumber, double y)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageNumber | Represents the bookmark pageindex of the loaded PDF document. |
| double | y | Represents the Y co-ordinate of the bookmark page of the loaded PDF document. |
Returns
| Type |
|---|
| Task |
GoToFirstPageAsync()
Navigate to first page of the PDF document loaded in the PDF Viewer.
Declaration
public Task GoToFirstPageAsync()
Returns
| Type |
|---|
| Task |
GoToLastPageAsync()
Navigate to last page of the PDF document loaded in the PDF Viewer.
Declaration
public Task GoToLastPageAsync()
Returns
| Type |
|---|
| Task |
GoToNextPageAsync()
Navigate to Next page of the PDF document loaded in the PDF Viewer.
Declaration
public Task GoToNextPageAsync()
Returns
| Type |
|---|
| Task |
GoToPageAsync(int)
Navigate to given page number in loaded document of the PDF Viewer..
Declaration
public Task GoToPageAsync(int pageNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageNumber |
Returns
| Type |
|---|
| Task |
Remarks
In case if we have provided incorrect page number as argument it will retain the existing page.
GoToPreviousPageAsync()
Navigate to Previous page of the PDF document.
Declaration
public Task GoToPreviousPageAsync()
Returns
| Type |
|---|
| Task |
ImportAnnotationAsync(Stream, AnnotationDataFormat)
Perform imports annotations action in the PDF Viewer
Declaration
public Task ImportAnnotationAsync(Stream importData, AnnotationDataFormat annotationDataFormat = AnnotationDataFormat.Json)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | importData | |
| AnnotationDataFormat | annotationDataFormat |
Returns
| Type |
|---|
| Task |
ImportAnnotationAsync(object, AnnotationDataFormat)
Perform imports annotations action in the PDF Viewer.
Declaration
public Task ImportAnnotationAsync(object importData, AnnotationDataFormat annotationDataFormat = AnnotationDataFormat.Json)
Parameters
| Type | Name | Description |
|---|---|---|
| object | importData | |
| AnnotationDataFormat | annotationDataFormat |
Returns
| Type |
|---|
| Task |
ImportFormFieldsAsync(Dictionary<string, string>)
Import the form fields.
Declaration
public Task ImportFormFieldsAsync(Dictionary<string, string> formFields)
Parameters
| Type | Name | Description |
|---|---|---|
| Dictionary<string, string> | formFields | Form fields details name and value will be in Dictionary format. |
Returns
| Type |
|---|
| Task |
ImportFormFieldsAsync(Stream, FormFieldDataFormat)
Import the form fields data into the current PDF document.
Declaration
public Task ImportFormFieldsAsync(Stream data, FormFieldDataFormat formattype = FormFieldDataFormat.Json)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | data | Represents the stream instance of form fields data. |
| FormFieldDataFormat | formattype | Represents the form fields data format. |
Returns
| Type |
|---|
| Task |
IsMainLicenseComponent()
Indicates this is a main license component
Declaration
protected override bool IsMainLicenseComponent()
Returns
| Type |
|---|
| bool |
LoadAsync(byte[], string)
Load a PDF Document from the byte array.
Declaration
public Task LoadAsync(byte[] bytes, string password = null)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | byte array of the PDF document to be loaded into the PDF Viewer. |
| string | password | Password for the PDF Document. |
Returns
| Type |
|---|
| Task |
LoadAsync(Stream, string)
Load a PDF Document from the stream.
Declaration
public Task LoadAsync(Stream stream, string password = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | Stream of the PDF document to be loaded into the PDF Viewer. |
| string | password | Password for the PDF Document. |
Returns
| Type |
|---|
| Task |
LoadAsync(string, string)
Loads the given PDF document in the PDF Viewer.
Declaration
public Task LoadAsync(string document, string password = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | document | |
| string | password |
Returns
| Type |
|---|
| Task |
OnAfterRenderAsync(bool)
Executes after the component has rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | firstRender |
Returns
| Type |
|---|
| Task |
OnHybridInitialized()
Initializes the hybrid properties of the PdfViewer component.
Declaration
protected Task OnHybridInitialized()
Returns
| Type |
|---|
| Task |
OnInitializedAsync()
Executes when the component is initialized. Performs the asynchronous initialization of the PDF Viewer.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type |
|---|
| Task |
OnParametersSetAsync()
Updates the component when parameters are set. It is used to detect changes in the component parameters and handle any necessary updates or actions.
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type |
|---|
| Task |
OpenThumbnailPaneAsync()
Open the thumbnail pane of the PDF Viewer.
Declaration
public Task OpenThumbnailPaneAsync()
Returns
| Type |
|---|
| Task |
PrintAsync()
Print the PDF document being loaded in the PDF Viewer.
Declaration
public Task PrintAsync()
Returns
| Type |
|---|
| Task |
RedactAsync()
Asynchronously applies redaction to all Redaction annotations in the PDF document.
Declaration
public Task RedactAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous redaction operation. |
Remarks
This method applies redaction to all annotations present across every page of the loaded PDF document. It processes the redaction asynchronously to avoid blocking the main thread.
Examples
public async void RedactAll()
{
await viewer.RedactAsync(); // Redacts all annotations in the document
}
RedoAsync()
Perform redo action for the edited annotations.
Declaration
public Task RedoAsync()
Returns
| Type |
|---|
| Task |
RetrieveFormFieldsAsync()
To retrieve the form fields in the loaded PDF Document.
Declaration
public Task<List<FormField>> RetrieveFormFieldsAsync()
Returns
| Type |
|---|
| Task<List<FormField>> |
SaveAsync(string)
Save the loaded the document with the changes in the given file path.
Declaration
public Task SaveAsync(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | file path to save the document. filepath should have the .pdf file extension. |
Returns
| Type |
|---|
| Task |
SearchNextAsync()
Searches the next occurrence of the searched text from the current occurrence of the PDF Viewer.
Declaration
public Task SearchNextAsync()
Returns
| Type |
|---|
| Task |
SearchPreviousAsync()
Searches the previous occurrence of the searched text from the current occurrence of the PDF Viewer.
Declaration
public Task SearchPreviousAsync()
Returns
| Type |
|---|
| Task |
SearchTextAsync(string, bool)
Searches the target text in the PDF document and highlights the occurrences in the PDF pages.
Declaration
public Task SearchTextAsync(string searchText, bool isMatchCase)
Parameters
| Type | Name | Description |
|---|---|---|
| string | searchText | |
| bool | isMatchCase |
Returns
| Type |
|---|
| Task |
SelectAnnotationAsync(PdfAnnotation)
Select the annotations using or annotation Id.
Declaration
public Task SelectAnnotationAsync(PdfAnnotation annotation)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfAnnotation | annotation | Annotation object to be deleted. |
Returns
| Type |
|---|
| Task |
SelectAnnotationAsync(string)
Select the annotations using or annotation Id.
Declaration
public Task SelectAnnotationAsync(string annotationId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | annotationId |
Returns
| Type |
|---|
| Task |
SelectFormFieldAsync(FormFieldInfo)
Asynchronously selects a form field in the PDF Viewer using a FormFieldInfo object.
Declaration
public Task SelectFormFieldAsync(FormFieldInfo formField)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFieldInfo | formField |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of selecting the specified form field. |
Remarks
This method sets the specified form field as the active selection based on the provided FormFieldInfo instance.
Use this method to programmatically focus on or manipulate a specific form field with detailed field information.
The following example demonstrates selecting a form field using a button.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="SelectFormField">Select Form Field</button>
@code {
SfPdfViewer2 pdfViewer;
async Task SelectFormField()
{
List<FormFieldInfo> formFields = await viewer.GetFormFieldsAsync();
if (formFields.Count > 0)
{
FormFieldInfo formField = formFields[0];
await pdfViewer.SelectFormFieldAsync(formField);
}
}
}
SelectFormFieldAsync(string)
Asynchronously selects a form field in the PDF Viewer by its identifier.
Declaration
public Task SelectFormFieldAsync(string formFieldId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | formFieldId |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of selecting the specified form field. |
Remarks
This method sets the specified form field as the active selection based on the provided form field ID.
Use this method to programmatically focus on or manipulate a specific form field.
The following example demonstrates selecting a form field using a button.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="SelectFormField">Select Form Field</button>
@code {
SfPdfViewer2 pdfViewer;
async Task SelectFormField()
{
await pdfViewer.SelectFormFieldAsync("formField1");
}
}
SelectTextRegionAsync(int, List<Bound>)
Select Text region based on the given bounds.
Declaration
public Task SelectTextRegionAsync(int pageNumbers, List<Bound> bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageNumbers | page number of the text content to be selected. |
| List<Bound> | bounds |
Returns
| Type |
|---|
| Task |
SetAnnotationModeAsync(AnnotationType)
Set annotation type to be added in next user interaction of the loaded PDF Document in the PDF Viewer.
Declaration
public Task SetAnnotationModeAsync(AnnotationType type)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationType | type |
Returns
| Type |
|---|
| Task |
SetAnnotationModeAsync(AnnotationType, DynamicStampItem?, SignStampItem?, StandardBusinessStampItem?)
Switch on the annotation mode.
Declaration
public Task SetAnnotationModeAsync(AnnotationType type, DynamicStampItem? dynamicStampItem, SignStampItem? signStampItem, StandardBusinessStampItem? standardBusinessStampItem)
Parameters
| Type | Name | Description |
|---|---|---|
| AnnotationType | type | Specify the annotation type like Rectangle, Highlight, Stamp etc., to be added. |
| DynamicStampItem? | dynamicStampItem | Specify the type of dynamic stamp item to be added. |
| SignStampItem? | signStampItem | Specify the sign stamp item to be added. |
| StandardBusinessStampItem? | standardBusinessStampItem | Specify the standard business stamp item to be added.. |
Returns
| Type |
|---|
| Task |
SetFormDrawingModeAsync(FormFieldType?)
Asynchronously sets or clears the form field type in the PDF Viewer.
Declaration
public Task SetFormDrawingModeAsync(FormFieldType? type = null)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFieldType? | type | The form field type to be set. If no argument is provided or |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of setting or clearing the form field type. |
Remarks
This method allows configuring different form field types in the PDF Viewer.
It supports various types defined in the FormFieldType enumeration.
If no argument is provided or null is passed, the current form field type will be cleared.
The following example demonstrates how to set or clear a form field type using buttons.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="SetFormDrawingMode">Set Form Field Type</button>
<button @onclick="ClearFormDrawingMode">Clear Form Field Type</button>
@code {
SfPdfViewer2 pdfViewer;
async Task SetFormDrawingMode()
{
await pdfViewer.SetFormDrawingModeAsync(FormFieldType.CheckBox);
}
async Task ClearFormDrawingMode()
{
await pdfViewer.SetFormDrawingModeAsync();
}
}
ShouldRender()
Declaration
protected override bool ShouldRender()
Returns
| Type |
|---|
| bool |
ShowAnnotationToolbar(bool)
Shows or hides the annotation toolbar in the PDF Viewer.
Declaration
public void ShowAnnotationToolbar(bool enableAnnotationToolbar)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enableAnnotationToolbar |
ShowNavigationToolbarAsync(bool)
Shows or hides the Navigation toolbar in the PDF Viewer.
Declaration
public Task ShowNavigationToolbarAsync(bool enableNavigationToolbar)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enableNavigationToolbar |
Returns
| Type |
|---|
| Task |
ShowRedactionToolbar(bool)
Shows or hides the annotation toolbar in the PDF Viewer based on the provided parameter.
Declaration
public void ShowRedactionToolbar(bool enableAnnotationToolbar)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enableAnnotationToolbar | A boolean value indicating whether to show or hide the redaction annotation toolbar.
Set to |
Remarks
This method toggles the visibility of the redaction annotation toolbar in the PDF Viewer. It allows the user to control the toolbar's visibility based on their interactions with the viewer.
Examples
private async void ShowRedactionToolbar()
{
redactionToolbar = !redactionToolbar;
SfPdfViewer2.ShowRedactionToolbar(redactionToolbar); // Shows or hides the toolbar
}
ShowToolbarAsync(bool)
Shows or hides the toolbar in the PDF Viewer.
Declaration
public Task ShowToolbarAsync(bool enableToolbar)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | enableToolbar |
Returns
| Type |
|---|
| Task |
ShowToolbarItemsAsync(List<ToolbarItem>, bool)
Shows or hides the the toolbar items in the PDF Viewer.
Declaration
public Task ShowToolbarItemsAsync(List<ToolbarItem> items, bool isVisible)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ToolbarItem> | items | |
| bool | isVisible |
Returns
| Type |
|---|
| Task |
ToggleItemByIndex(int)
Toggles the visibility of the custom panel associated with the specified index in the navigation toolbar.
Declaration
public Task ToggleItemByIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The zero-based index of the custom toolbar item whose corresponding panel should be toggled. |
Returns
| Type |
|---|
| Task |
Remarks
This method switches the visibility state (show or hide) of the panel linked to the custom navigation toolbar item at the given index. Useful for scenarios where the panel should respond to user interactions or dynamic conditions.
Examples
// Toggle visibility of the panel at index 2
await SfPdfViewer2.ToggleItemByIndex(2);
UndoAsync()
Perform undo action for the edited annotations.
Declaration
public Task UndoAsync()
Returns
| Type |
|---|
| Task |
UnloadAsync()
Unloads the PDF document being displayed in the PDF viewer.
Declaration
public Task UnloadAsync()
Returns
| Type |
|---|
| Task |
UpdateFormFieldsAsync(FormField)
Asynchronously updates specified form fields in the PDF Viewer.
Declaration
public Task UpdateFormFieldsAsync(FormField formField)
Parameters
| Type | Name | Description |
|---|---|---|
| FormField | formField |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation of updating the specified form fields in the PDF Viewer. |
Remarks
This method updates the specified form fields in the PDF Viewer based on the provided list of FormFieldInfo objects.
Ensure each object includes valid data for the respective field before calling this method.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="UpdateFormFields">Update Form Fields</button>
@code {
SfPdfViewer2 pdfViewer;
async Task UpdateFormFields()
{
List<![CDATA[<FormFieldInfo> formFields = await viewer.GetFormFieldsAsync();
TextBoxField textBoxField = formFields[0] as TextBoxField;
textBoxField.Value = "Updated";
await viewer.UpdateFormFieldsAsync(new List<FormFieldInfo>(){
textBoxField
});
}
}
UpdateFormFieldsAsync(List<FormFieldInfo>)
Asynchronously updates specified form fields in the PDF Viewer.
Declaration
public Task UpdateFormFieldsAsync(List<FormFieldInfo> formFields)
Parameters
| Type | Name | Description |
|---|---|---|
| List<FormFieldInfo> | formFields |
Returns
| Type | Description |
|---|---|
| Task | A Task that represents the asynchronous operation of updating the specified form fields in the PDF Viewer. |
Remarks
This method updates the specified form fields in the PDF Viewer based on the provided list of FormFieldInfo objects.
Ensure each object includes valid data for the respective field before calling this method.
Examples
<SfPdfViewer2 @ref="pdfViewer"></SfPdfViewer2>
<button @onclick="UpdateFormFields">Update Form Fields</button>
@code {
SfPdfViewer2 pdfViewer;
async Task UpdateFormFields()
{
List<FormFieldInfo> formFields = await viewer.GetFormFieldsAsync();
TextBoxField textBoxField = formFields[0] as TextBoxField;
textBoxField.Value = "Updated";
await viewer.UpdateFormFieldsAsync(new List<FormFieldInfo>(){
textBoxField
});
}
}
UpdateMeasurementSettingsAsync()
Update measure settings for existing measure annotations.
Declaration
public Task UpdateMeasurementSettingsAsync()
Returns
| Type |
|---|
| Task |
UpdateViewerContainerAsync()
updates the PDF Viewer container width and height from externally.
Declaration
public Task UpdateViewerContainerAsync()
Returns
| Type |
|---|
| Task |
ZoomAsync(int)
Zoom the PDF document to the given zoom value. It's range varies from 10 to 400.
Declaration
public Task ZoomAsync(int zoomValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | zoomValue |
Returns
| Type |
|---|
| Task |
ZoomInAsync()
Scale the page to the next value in the zoom drop down list. Drop down values are 10,25,50,75,100,125,150,200,400.
Declaration
public Task ZoomInAsync()
Returns
| Type |
|---|
| Task |
ZoomOutAsync()
Magnifies the page to the previous value in the zoom drop down list. Drop down values are 10,25,50,75,100,125,150,200,400.
Declaration
public Task ZoomOutAsync()
Returns
| Type |
|---|
| Task |