Class SfSmartPdfViewer
The SmartPdfViewer is an AI-powered control that extends the Syncfusion.Blazor.SfPdfViewer. It allows for seamless interaction with PDF documents by incorporating AI-assisted functionalities.
Inherited Members
Namespace: Syncfusion.Blazor.SmartPdfViewer
Assembly: Syncfusion.Blazor.SmartPdfViewer.dll
Syntax
public class SfSmartPdfViewer : SfPdfViewer2
Examples
<SfSmartPdfViewer Height="100%" width="100%">
</SfSmartPdfViewer>
Constructors
SfSmartPdfViewer()
Declaration
public SfSmartPdfViewer()
Methods
ApplySmartFillAsync()
Initiates the Smart Fill process using extracted form field names and the current clipboard data. When executed, this method uses AI to analyze the clipboard content and map it to named form fields within the loaded PDF.
Declaration
public Task ApplySmartFillAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
The ApplySmartFillAsync()
method requires that form fields have valid names; AI cannot populate fields without identifiers.
The clipboard data is parsed and mapped via AI to corresponding fields, minimizing manual entry and improving accuracy.
Examples
The following example shows how to apply Smart Fill for open forms with clipboard content:
<SfSmartPdfViewer @ref="smartPdfViewer">
<SmartFillSettings />
</SfSmartPdfViewer>
@code {
public async void SmartFormFill()
{
await smartPdfViewer.ApplySmartFillAsync();
}
}
ApplySmartFillAsync(String)
Initiates the Smart Fill process using the specified string data instead of clipboard content.
Declaration
public Task ApplySmartFillAsync(string data)
Parameters
Type | Name | Description |
---|---|---|
System.String | data | The custom data (string value) to be used by the AI for mapping values to form fields during the Smart Fill process. |
Returns
Type |
---|
System.Threading.Tasks.Task |
Remarks
This overload of ApplySmartFillAsync(string data)
gives developers or users full control over the data source for form filling, supporting custom, user-provided, or application-integrated content.
Form fields without proper names cannot be automatically populated, as the AI workflow requires unique keys for mapping values correctly.
Examples
The following example demonstrates how to invoke Smart Fill with your own data:
<SfSmartPdfViewer @ref="smartPdfViewer" >
<SmartFillSettings />
</SfSmartPdfViewer>
@code {
public async void SmartFormFill()
{
await smartPdfViewer.ApplySmartFillAsync("FirstName: Alice; LastName: Smith; Email: [email protected];");
}
}
Dispose()
Dispose the Smart PDF Viewer and it's dependencies.
Declaration
public override void Dispose()
Overrides
GetPrompts()
Gets or sets a value indicating whether the response toolbar icons are shown.
Declaration
public List<AssistViewPrompt> GetPrompts()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<AssistViewPrompt> |
|
Examples
<SfSmartPdfViewer @ref="settings">
</SfSmartPdfViewer>
@code {
private List<AssistViewPrompt> prompts = new List<AssistViewPrompt>();
protected override void OnAfterRender(bool firstRender)
{
prompts = settings.GetPrompts();
}
}
OnAfterRenderAsync(Boolean)
Handles the after render event of the component to perform actions after the component has rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender | Indicates the first render |
Returns
Type |
---|
System.Threading.Tasks.Task |
Overrides
OnInitialized()
Occurs when the control is being initialized
Declaration
protected override void OnInitialized()
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 |