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
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
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
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
public PdfViewerArrowSettings ArrowSettings { get; set; }
Property Value
Type |
---|
PdfViewerArrowSettings |
CanRedo
Gets a value that indicates whether the most recent action can be undone.
Declaration
public bool CanRedo { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | false |
Examples
<SfPdfViewer2 CanRedo=true >
</SfPdfViewer2>
CanRedoChanged
Gets or sets a callback that updates the CanRedo bound value.
Declaration
public EventCallback<bool> CanRedoChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Boolean> |
CanUndo
Gets a value indicating whether the user can undo the previous operation in the PDF Viewer control.
Declaration
public bool CanUndo { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | false |
Examples
<SfPdfViewer2 CanUndo=true >
</SfPdfViewer2>
CanUndoChanged
Gets or sets a callback that updates the CanUndo bound value.
Declaration
public EventCallback<bool> CanUndoChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Boolean> |
ChildContent
ChildContent used to define child elements for the root component.
Declaration
public RenderFragment ChildContent { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.RenderFragment |
CircleSettings
Defines the settings of circle annotation. It used to customize circle annotation properties.
Declaration
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
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
public PdfViewerCommentPanelSettings CommentPanelSettings { get; set; }
Property Value
Type |
---|
PdfViewerCommentPanelSettings |
CommentPanelVisible
Defines the visibility of the comment panel in the PDF Viewer.
Declaration
public bool CommentPanelVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | false |
Examples
<SfPdfViewer2 CommentPanelVisible=true >
</SfPdfViewer2>
CommentPanelVisibleChanged
EventCallback to update the CommentPanelVisible value in the parent component.
Declaration
public EventCallback<bool> CommentPanelVisibleChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Boolean> |
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
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
public string CssClass { get; set; }
Property Value
Type |
---|
System.String |
CurrentPageNumber
Gets or sets the current page number of the PDF Viewer.
Declaration
public int CurrentPageNumber { get; set; }
Property Value
Type |
---|
System.Int32 |
CurrentPageNumberChanged
Gets the event callback for CurrentPageNumber.
Declaration
public EventCallback<int> CurrentPageNumberChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Int32> |
CurrentPageNumberExpression
Gets the expression for CurrentPageNumber.
Declaration
public Expression<Func<int>> CurrentPageNumberExpression { get; set; }
Property Value
Type |
---|
System.Linq.Expressions.Expression<System.Func<System.Int32>> |
CustomFonts
Sets the Custom fonts path locations for initial loading.
Declaration
public List<string> CustomFonts { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.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
public PdfViewerCustomStampSettings CustomStampSettings { get; set; }
Property Value
Type |
---|
PdfViewerCustomStampSettings |
DistanceSettings
Defines the settings of distance annotation. It used to customize distance annotation properties.
Declaration
public PdfViewerDistanceSettings DistanceSettings { get; set; }
Property Value
Type |
---|
PdfViewerDistanceSettings |
DocumentPath
Sets the PDF document path for initial loading.
Declaration
public string DocumentPath { get; set; }
Property Value
Type |
---|
System.String |
DownloadFileName
Sets the name of the file to be downloaded.
Declaration
public string DownloadFileName { get; set; }
Property Value
Type |
---|
System.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
public bool EnableAnnotation { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableAnnotationToolbar
If it is set as false, then the edit annotation option in the toolbar will be disabled. By default it is true.
Declaration
public bool EnableAnnotationToolbar { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableAutoComplete
If it is set as false, auto complete behavior of form fields will be disabled. Be default it is true.
Declaration
public bool EnableAutoComplete { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableBookmarkPanel { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableChunkMessages { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableCommentPanel { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableDesktopMode
Gets or sets a boolean value to show or hide desktop toolbar in mobile devices. FALSE by default.
Declaration
public bool EnableDesktopMode { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableDownload { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableErrorDialog
If it is set as false, then error dialogue display in PDF Viewer will be disabled, By default it is true.
Declaration
public bool EnableErrorDialog { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableFormDesigner
Gets or sets a value indicating whether the form designer is enabled in the PDF Viewer.
Declaration
public bool EnableFormDesigner { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
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
public bool EnableFormFields { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableFormFieldsValidation
If it is set as true, validate form fields will be triggered. By default it is false.
Declaration
public bool EnableFormFieldsValidation { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableFreeText { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableHandwrittenSignature { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableHyperlink
If it is set as false, then hyperlink in the PDF Viewer will be disabled, By default it is true.
Declaration
public bool EnableHyperlink { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableImportAnnotationMeasurement
Enable or disables the customization of measure values in PdfViewer.
Declaration
public bool EnableImportAnnotationMeasurement { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableInkAnnotation { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableMagnification { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableMeasureAnnotation { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableNavigation
If it is set as false, then page navigation of the PDF Viewer will be disabled. By default it is true.
Declaration
public bool EnableNavigation { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableNavigationToolbar { get; set; }
Property Value
Type |
---|
System.Boolean |
EnablePinchZoom
If it is set as false, then pinch zoom of the PDF Viewer will be disabled. By default it is true.
Declaration
public bool EnablePinchZoom { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnablePrint { get; set; }
Property Value
Type |
---|
System.Boolean |
EnablePrintRotation
If it is set as FALSE, will suppress the page rotation of Landscape document on print action. By default it is TRUE.
Declaration
public bool EnablePrintRotation { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableRtl { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableShapeAnnotation { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableShapeLabel { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableStampAnnotations { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableStickyNotesAnnotation { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableTextMarkupAnnotation { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableTextSearch
If it is set as false, then text search support in the PDF Viewer will be disabled, By default it is true.
Declaration
public bool EnableTextSearch { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableTextSelection
If it is set as false, then text selection in the PDF Viewer will be disabled, By default it is true.
Declaration
public bool EnableTextSelection { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableThumbnailPanel { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableToolbar { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool EnableZoomOptimization { get; set; }
Property Value
Type |
---|
System.Boolean |
ExportAnnotationFileName
Gets or sets the file name of annotations to be exported.
Declaration
public string ExportAnnotationFileName { get; set; }
Property Value
Type |
---|
System.String |
FallbackFontCollection
It is used to import the custom fonts into PDF Viewer.
Declaration
public Dictionary<string, Stream> FallbackFontCollection { get; }
Property Value
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.IO.Stream> |
FontFamilies
Defines the list of preferred font families specified by the user.
Declaration
public string[] FontFamilies { get; set; }
Property Value
Type | Description |
---|---|
System.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. 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
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
public PdfViewerHandwrittenSignatureSettings HandwrittenSignatureSettings { get; set; }
Property Value
Type |
---|
PdfViewerHandwrittenSignatureSettings |
Height
Gets or sets the scrollable height of the PDF Viewer.
Declaration
public string Height { get; set; }
Property Value
Type |
---|
System.String |
HighlightSettings
Defines the settings of highlight annotation. It used to customize the highlight annotation properties.
Declaration
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
public LinkTarget HyperlinkOpenState { get; set; }
Property Value
Type |
---|
LinkTarget |
ID
Gets or sets the ID for the PDF Viewer parent DOM elemet div.
Declaration
public string ID { get; set; }
Property Value
Type |
---|
System.String |
InkAnnotationSettings
Defines the ink annotation settings for PDF Viewer.It used to customize the strokeColor, thickness, opacity of the ink annotation.
Declaration
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
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 |
---|
System.Boolean |
IsDesignerMode
Gets or sets a value indicating whether the designer mode is active in the PDF Viewer.
Declaration
public bool IsDesignerMode { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
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
public EventCallback<bool> IsDesignerModeChanged { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.AspNetCore.Components.EventCallback<System.Boolean> | An Microsoft.AspNetCore.Components.EventCallback<> 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
public bool IsDocumentEdited { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool IsExtractText { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool IsFormFieldDocument { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool IsSignatureEditable { get; set; }
Property Value
Type |
---|
System.Boolean |
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
public bool IsThumbnailPanelOpen { get; set; }
Property Value
Type |
---|
System.Boolean |
jsProperty
Declaration
protected virtual string jsProperty { get; set; }
Property Value
Type |
---|
System.String |
jsRuntime
Declaration
protected IJSRuntime jsRuntime { get; set; }
Property Value
Type |
---|
Microsoft.JSInterop.IJSRuntime |
LineSettings
Defines the settings of line annotation. It used to customize the line annotation properties.
Declaration
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
public string Locale { get; set; }
Property Value
Type |
---|
System.String |
MeasurementSettings
Defines the settings of measurement annotation. It used to customize the measurement annotation properties.
Declaration
public PdfViewerMeasurementSettings MeasurementSettings { get; set; }
Property Value
Type |
---|
PdfViewerMeasurementSettings |
nameSpace
Declaration
protected virtual string nameSpace { get; set; }
Property Value
Type |
---|
System.String |
OverscanCount
Gets or sets the number of pages that should be preloaded in the PDF Viewer to enhance scrolling experience.
Declaration
public int OverscanCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | 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
public int PageCount { get; set; }
Property Value
Type |
---|
System.Int32 |
PageCountChanged
Gets the event callback for PageCount.
Declaration
public EventCallback<int> PageCountChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Int32> |
PageCountExpression
Gets the expression for PageCount.
Declaration
public Expression<Func<int>> PageCountExpression { get; set; }
Property Value
Type |
---|
System.Linq.Expressions.Expression<System.Func<System.Int32>> |
PerimeterSettings
Defines the settings of perimeter annotation. It used to customize the perimeter annotation properties.
Declaration
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
public PdfViewerPolygonSettings PolygonSettings { get; set; }
Property Value
Type |
---|
PdfViewerPolygonSettings |
PrintMode
Specifies the print mode in the PDF Viewer.
Declaration
public PrintMode PrintMode { get; set; }
Property Value
Type |
---|
PrintMode |
PrintScaleFactor
Specifies the document printing quality.
Declaration
public double PrintScaleFactor { get; set; }
Property Value
Type | Description |
---|---|
System.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
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
public PdfViewerRectangleSettings RectangleSettings { get; set; }
Property Value
Type |
---|
PdfViewerRectangleSettings |
RestrictZoomRequest
If it is set as true, then page image will be fetched only when the zoom percentage is 100. Otherwise, mutliple page image fetched for different zoom percentages on performing zoom operation. By default it is false.
Declaration
public bool RestrictZoomRequest { get; set; }
Property Value
Type |
---|
System.Boolean |
RetryCount
Gets or sets the retry count for PDF Viewer service call. By default retrycount is 1.
Declaration
public double RetryCount { get; set; }
Property Value
Type |
---|
System.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
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
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
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
public bool ShowDigitalSignatureAppearance { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true |
Examples
<SfPdfViewer2 ShowDigitalSignatureAppearance=true >
</SfPdfViewer2>
SquigglySettings
Defines the settings of squiggly annotation. It used to customize the squiggly annotation properties.
Declaration
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
public PdfViewerStampSettings StampSettings { get; set; }
Property Value
Type |
---|
PdfViewerStampSettings |
StickyNotesSettings
Defines the settings of stickyNotes annotation.
Declaration
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
public PdfViewerStrikethroughSettings StrikethroughSettings { get; set; }
Property Value
Type |
---|
PdfViewerStrikethroughSettings |
TextSearchColorSettings
Configure the search text and highlight text color for the PDF Viewer.
Declaration
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
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
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
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
public PdfViewerVolumeSettings VolumeSettings { get; set; }
Property Value
Type |
---|
PdfViewerVolumeSettings |
Width
Gets or sets the scrollable width of the PDF Viewer.
Declaration
public string Width { get; set; }
Property Value
Type |
---|
System.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
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
public int ZoomValue { get; set; }
Property Value
Type |
---|
System.Int32 |
ZoomValueChanged
Gets the event callback for ZoomValue.
Declaration
public EventCallback<int> ZoomValueChanged { get; set; }
Property Value
Type |
---|
Microsoft.AspNetCore.Components.EventCallback<System.Int32> |
ZoomValueExpression
Gets the expression for ZoomValue.
Declaration
public Expression<Func<int>> ZoomValueExpression { get; set; }
Property Value
Type |
---|
System.Linq.Expressions.Expression<System.Func<System.Int32>> |
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 |
---|---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.List<PdfAnnotation> | annotationCollection | The collection of PDF annotations to be added. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.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 |
---|---|---|
System.String | text | |
System.String | id |
Returns
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.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 |
---|---|---|
System.Collections.Generic.List<FormFieldInfo> | formFields |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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);
}
}
CancelTextSearchAsync()
Cancels the text search of the PDF Viewer.
Declaration
public Task CancelTextSearchAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
ClearSelectionAsync()
Clear the annotation selection in the PDF Viewer.
Declaration
public Task ClearSelectionAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
ClearTextSelectionAsync()
Clear the text selection.
Declaration
public Task ClearTextSelectionAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
DeleteAnnotationAsync()
Delete the selected annotation in the PDF Viewer.
Declaration
public Task DeleteAnnotationAsync()
Returns
Type |
---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.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 |
---|---|---|
System.String | annotationId | The identifier of the annotation to be deleted. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.List<PdfAnnotation> | annotationCollection | The collection of PDF annotations to be deleted. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.List<System.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 |
---|---|
System.Threading.Tasks.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(Boolean)
Asynchronously deletes form fields in the PDF Viewer.
Declaration
public Task DeleteFormFieldsAsync(bool deleteAllFields = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | deleteAllFields | A boolean value indicating whether to delete all form fields.
If |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.List<FormFieldInfo> | formFields |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.List<System.String> | formFieldIds |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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(Boolean)
Dispose the unmanaged resources from PDF Viewer component.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
DownloadAsync()
Downloads the PDF document being loaded in the PDF Viewer.
Declaration
public Task DownloadAsync()
Returns
Type |
---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.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>, Boolean)
Enables or disables the the toolbar items in the PDF Viewer.
Declaration
public Task EnableToolbarItemsAsync(List<ToolbarItem> items, bool isEnable)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ToolbarItem> | items | |
System.Boolean | isEnable |
Returns
Type |
---|
System.Threading.Tasks.Task |
ExportAnnotationAsStreamAsync(AnnotationDataFormat)
Perform export annotations as Stream in the PDF Viewer.
Declaration
public Task<Stream> ExportAnnotationAsStreamAsync(AnnotationDataFormat annotationDataFormat)
Parameters
Type | Name | Description |
---|---|---|
AnnotationDataFormat | annotationDataFormat |
Returns
Type |
---|
System.Threading.Tasks.Task<System.IO.Stream> |
ExportAnnotationAsync(AnnotationDataFormat)
Perform export annotations action in the PDF Viewer.
Declaration
public Task ExportAnnotationAsync(AnnotationDataFormat annotationDataFormat)
Parameters
Type | Name | Description |
---|---|---|
AnnotationDataFormat | annotationDataFormat |
Returns
Type |
---|
System.Threading.Tasks.Task |
ExportAnnotationsAsObjectAsync()
Perform export annotations action in the PDF Viewer.
Declaration
public Task<object> ExportAnnotationsAsObjectAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Object> |
ExportFormFieldsAsObjectAsync()
Perform export annotations action in the PDF Viewer.
Declaration
public Task<Dictionary<string, string>> ExportFormFieldsAsObjectAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.String, System.String>> |
ExportFormFieldsAsync(FormFieldDataFormat)
Exports the form fields data as stream.
Declaration
public Task<Stream> ExportFormFieldsAsync(FormFieldDataFormat formattype)
Parameters
Type | Name | Description |
---|---|---|
FormFieldDataFormat | formattype | Represents the form fields data format. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.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 |
---|---|---|
System.String | path |
Returns
Type |
---|
System.Threading.Tasks.Task |
FitToHeightAsync()
Scales the page to fit the page width within container height of the PDF Viewer.
Declaration
public Task FitToHeightAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
FitToPageAsync()
Scales the page to fit with in the container of the PDF Viewer.
Declaration
public Task FitToPageAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
FitToWidthAsync()
Scales the page to fit the page width within container width of the PDF Viewer.
Declaration
public Task FitToWidthAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
GetAnnotationsAsync()
Gets the annotations collection.
Declaration
public Task<List<PdfAnnotation>> GetAnnotationsAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Collections.Generic.List<PdfAnnotation>> |
GetAriaLabelValue(String)
Creates a dictionary containing an "aria-label" entry.
Declaration
public Dictionary<string, object> GetAriaLabelValue(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Returns
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
GetAriaLabelValue(String, Boolean)
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 |
---|---|---|
System.String | text | |
System.Boolean | enabledState |
Returns
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.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 |
---|---|---|
System.String | text | |
System.String | label |
Returns
Type |
---|
System.Collections.Generic.Dictionary<System.String, System.Object> |
GetBookmarksAsync()
Get bookmarks of the PDF document being loaded in the PDF Viewer.
Declaration
public Task<List<Bookmark>> GetBookmarksAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Collections.Generic.List<Bookmark>> |
GetDocumentAsync()
Gets the loaded PDF document with the changes.
Declaration
public Task<byte[]> GetDocumentAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Byte[]> |
GetFormFieldsAsync()
Asynchronously retrieves form fields from the PDF Viewer.
Declaration
public Task<List<FormFieldInfo>> GetFormFieldsAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.List<FormFieldInfo>> | A System.Threading.Tasks.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();
}
}
GetJSNamespace()
Returns the PDF Viewer namespace
Declaration
public string GetJSNamespace()
Returns
Type | Description |
---|---|
System.String | String |
GetPageCountAsync()
Returns the page count of the document loaded in the PdfViewer control.
Declaration
public Task<int> GetPageCountAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Int32> |
GetZoomPercentageAsync()
Returns the current zoom percentage of the PdfViewer control.
Declaration
public Task<int> GetZoomPercentageAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Int32> |
GoToBookmarkAsync(Int32, 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 |
---|---|---|
System.Int32 | pageNumber | Represents the bookmark pageindex of the loaded PDF document. |
System.Double | y | Represents the Y co-ordinate of the bookmark page of the loaded PDF document. |
Returns
Type |
---|
System.Threading.Tasks.Task |
GoToFirstPageAsync()
Navigate to first page of the PDF document loaded in the PDF Viewer.
Declaration
public Task GoToFirstPageAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
GoToLastPageAsync()
Navigate to last page of the PDF document loaded in the PDF Viewer.
Declaration
public Task GoToLastPageAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
GoToNextPageAsync()
Navigate to Next page of the PDF document loaded in the PDF Viewer.
Declaration
public Task GoToNextPageAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
GoToPageAsync(Int32)
Navigate to given page number in loaded document of the PDF Viewer..
Declaration
public Task GoToPageAsync(int pageNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumber |
Returns
Type |
---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.Task |
ImportAnnotationAsync(Stream, AnnotationDataFormat)
Perform imports annotations action in the PDF Viewer
Declaration
public Task ImportAnnotationAsync(Stream importData, AnnotationDataFormat annotationDataFormat)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | importData | |
AnnotationDataFormat | annotationDataFormat |
Returns
Type |
---|
System.Threading.Tasks.Task |
ImportAnnotationAsync(Object, AnnotationDataFormat)
Perform imports annotations action in the PDF Viewer.
Declaration
public Task ImportAnnotationAsync(object importData, AnnotationDataFormat annotationDataFormat)
Parameters
Type | Name | Description |
---|---|---|
System.Object | importData | |
AnnotationDataFormat | annotationDataFormat |
Returns
Type |
---|
System.Threading.Tasks.Task |
ImportFormFieldsAsync(Dictionary<String, String>)
Import the form fields.
Declaration
public Task ImportFormFieldsAsync(Dictionary<string, string> formFields)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | formFields | Form fields details name and value will be in Dictionary format. |
Returns
Type |
---|
System.Threading.Tasks.Task |
ImportFormFieldsAsync(Stream, FormFieldDataFormat)
Import the form fields data into the current PDF document.
Declaration
public Task ImportFormFieldsAsync(Stream data, FormFieldDataFormat formattype)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | data | Represents the stream instance of form fields data. |
FormFieldDataFormat | formattype | Represents the form fields data format. |
Returns
Type |
---|
System.Threading.Tasks.Task |
LoadAsync(Byte[], String)
Load a PDF Document from the byte array.
Declaration
public Task LoadAsync(byte[] bytes, string password = null)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | byte array of the PDF document to be loaded into the PDF Viewer. |
System.String | password | Password for the PDF Document. |
Returns
Type |
---|
System.Threading.Tasks.Task |
LoadAsync(Stream, String)
Load a PDF Document from the stream.
Declaration
public Task LoadAsync(Stream stream, string password = null)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream of the PDF document to be loaded into the PDF Viewer. |
System.String | password | Password for the PDF Document. |
Returns
Type |
---|
System.Threading.Tasks.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 |
---|---|---|
System.String | document | |
System.String | password |
Returns
Type |
---|
System.Threading.Tasks.Task |
OnAfterRenderAsync(Boolean)
Executes after the component has rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
Returns
Type |
---|
System.Threading.Tasks.Task |
OnHybridInitialized()
Initializes the hybrid properties of the PdfViewer component.
Declaration
protected Task OnHybridInitialized()
Returns
Type |
---|
System.Threading.Tasks.Task |
OnInitializedAsync()
Executes when the component is initialized. Performs the asynchronous initialization of the PDF Viewer.
Declaration
protected override Task OnInitializedAsync()
Returns
Type |
---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.Task |
OpenThumbnailPaneAsync()
Open the thumbnail pane of the PDF Viewer.
Declaration
public Task OpenThumbnailPaneAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
PrintAsync()
Print the PDF document being loaded in the PDF Viewer.
Declaration
public Task PrintAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
RedoAsync()
Perform redo action for the edited annotations.
Declaration
public Task RedoAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
RetrieveFormFieldsAsync()
To retrieve the form fields in the loaded PDF Document.
Declaration
public Task<List<FormField>> RetrieveFormFieldsAsync()
Returns
Type |
---|
System.Threading.Tasks.Task<System.Collections.Generic.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 |
---|---|---|
System.String | filePath | file path to save the document. filepath should have the .pdf file extension. |
Returns
Type |
---|
System.Threading.Tasks.Task |
SearchNextAsync()
Searches the next occurrence of the searched text from the current occurrence of the PDF Viewer.
Declaration
public Task SearchNextAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
SearchPreviousAsync()
Searches the previous occurrence of the searched text from the current occurrence of the PDF Viewer.
Declaration
public Task SearchPreviousAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
SearchTextAsync(String, Boolean)
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 |
---|---|---|
System.String | searchText | |
System.Boolean | isMatchCase |
Returns
Type |
---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.Task |
SelectAnnotationAsync(String)
Select the annotations using or annotation Id.
Declaration
public Task SelectAnnotationAsync(string annotationId)
Parameters
Type | Name | Description |
---|---|---|
System.String | annotationId |
Returns
Type |
---|
System.Threading.Tasks.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 |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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 |
---|---|---|
System.String | formFieldId |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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(Int32, List<Bound>)
Select Text region based on the given bounds.
Declaration
public Task SelectTextRegionAsync(int pageNumbers, List<Bound> bounds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageNumbers | page number of the text content to be selected. |
System.Collections.Generic.List<Bound> | bounds |
Returns
Type |
---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.Task |
SetAnnotationModeAsync(AnnotationType, Nullable<DynamicStampItem>, Nullable<SignStampItem>, Nullable<StandardBusinessStampItem>)
Switch on the annotation mode.
Declaration
public Task SetAnnotationModeAsync(AnnotationType type, Nullable<DynamicStampItem> dynamicStampItem, Nullable<SignStampItem> signStampItem, Nullable<StandardBusinessStampItem> standardBusinessStampItem)
Parameters
Type | Name | Description |
---|---|---|
AnnotationType | type | Specify the annotation type like Rectangle, Highlight, Stamp etc., to be added. |
System.Nullable<DynamicStampItem> | dynamicStampItem | Specify the type of dynamic stamp item to be added. |
System.Nullable<SignStampItem> | signStampItem | Specify the sign stamp item to be added. |
System.Nullable<StandardBusinessStampItem> | standardBusinessStampItem | Specify the standard business stamp item to be added.. |
Returns
Type |
---|
System.Threading.Tasks.Task |
SetFormDrawingModeAsync(Nullable<FormFieldType>)
Asynchronously sets or clears the form field type in the PDF Viewer.
Declaration
public Task SetFormDrawingModeAsync(Nullable<FormFieldType> type = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<FormFieldType> | type | The form field type to be set. If no argument is provided or |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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 |
---|
System.Boolean |
ShowAnnotationToolbar(Boolean)
Shows or hides the annotation toolbar in the PDF Viewer.
Declaration
public void ShowAnnotationToolbar(bool enableAnnotationToolbar)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enableAnnotationToolbar |
ShowNavigationToolbarAsync(Boolean)
Shows or hides the Navigation toolbar in the PDF Viewer.
Declaration
public Task ShowNavigationToolbarAsync(bool enableNavigationToolbar)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enableNavigationToolbar |
Returns
Type |
---|
System.Threading.Tasks.Task |
ShowToolbarAsync(Boolean)
Shows or hides the toolbar in the PDF Viewer.
Declaration
public Task ShowToolbarAsync(bool enableToolbar)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enableToolbar |
Returns
Type |
---|
System.Threading.Tasks.Task |
ShowToolbarItemsAsync(List<ToolbarItem>, Boolean)
Shows or hides the the toolbar items in the PDF Viewer.
Declaration
public Task ShowToolbarItemsAsync(List<ToolbarItem> items, bool isVisible)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<ToolbarItem> | items | |
System.Boolean | isVisible |
Returns
Type |
---|
System.Threading.Tasks.Task |
UndoAsync()
Perform undo action for the edited annotations.
Declaration
public Task UndoAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
UnloadAsync()
Unloads the PDF document being displayed in the PDF viewer.
Declaration
public Task UnloadAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
UpdateChildProperties(String, Object)
Updates the child properties of the PDF Viewer component based on the specified key and value.
Declaration
public void UpdateChildProperties(string key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | |
System.Object | value |
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 |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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 |
---|---|---|
System.Collections.Generic.List<FormFieldInfo> | formFields |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.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 |
---|
System.Threading.Tasks.Task |
UpdateViewerContainerAsync()
updates the PDF Viewer container width and height from externally.
Declaration
public Task UpdateViewerContainerAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
ZoomAsync(Int32)
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 |
---|---|---|
System.Int32 | zoomValue |
Returns
Type |
---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.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 |
---|
System.Threading.Tasks.Task |