GroupDocs.Viewer.UI.Api
8.1.1
Prefix Reserved
dotnet add package GroupDocs.Viewer.UI.Api --version 8.1.1
NuGet\Install-Package GroupDocs.Viewer.UI.Api -Version 8.1.1
<PackageReference Include="GroupDocs.Viewer.UI.Api" Version="8.1.1" />
<PackageVersion Include="GroupDocs.Viewer.UI.Api" Version="8.1.1" />
<PackageReference Include="GroupDocs.Viewer.UI.Api" />
paket add GroupDocs.Viewer.UI.Api --version 8.1.1
#r "nuget: GroupDocs.Viewer.UI.Api, 8.1.1"
#:package GroupDocs.Viewer.UI.Api@8.1.1
#addin nuget:?package=GroupDocs.Viewer.UI.Api&version=8.1.1
#tool nuget:?package=GroupDocs.Viewer.UI.Api&version=8.1.1
UI for GroupDocs.Viewer for .NET (API)
GroupDocs.Viewer.UI.Api
contains base types for implementing an API for GroupDocs.Viewer.UI
.
There are two API implementations provided within this package:
GroupDocs.Viewer.UI.SelfHost.Api
- A self-hosted service that uses the GroupDocs.Viewer package.GroupDocs.Viewer.UI.Cloud.Api
- Uses the cloud API provided by GroupDocs.
This readme includes information and usage examples for the features provided by this module.
Features
This section lists the features provided by the module.
Error Handling
Types that enable you to display custom error messages can be found in the ErrorHandling folder. The key type here is the ErrorMessageProvider.cs interface, which defines a contract for providing user-friendly error messages based on exceptions.
The following code demonstrates how to implement a custom error message provider:
using GroupDocs.Viewer.UI.Api;
//...
public class MyErrorMessageProvider : IErrorMessageProvider
{
public string GetErrorMessage(Exception exception, ErrorContext context)
{
return "This is my custom error message...";
}
}
Once the custom error message provider is implemented, it can be registered during the application composition stage.
The following code snippet shows how to register a custom service as a singleton:
using GroupDocs.Viewer.UI.Api;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IErrorMessageProvider, MyErrorMessageProvider>();
NOTE: The service should be registered before you register the self-hosted or cloud API for it to take effect. By default, ExceptionMessageProvider.cs is registered. This class provides a default implementation that returns the exception error message.
Once a custom error message provider is registered, a popup with the custom error message will be displayed in case of an error.
File Name Resolution
In case you're using identifiers instead of file names but you also want to show actual file name in UI you have to implement IFileNameResolver
interface to map a file identifier to the file name.
The following code demonstrates how to implement a custom file name resolver:
using GroupDocs.Viewer.UI.Api;
//...
public class MyFileNameResolver : IFileNameResolver
{
public Task<string> ResolveFileNameAsync(string file)
{
return Task.FromResult("quaterly-report.docx");
}
}
Once the custom file name resolver is implemented, it can be registered during the application composition stage.
The following code snippet shows how to register a custom service as a singleton:
using GroupDocs.Viewer.UI.Api;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IFileNameResolver, MyFileNameResolver>();
NOTE: The service should be registered before you register the self-hosted or cloud API for it to take effect. By default, FilePathFileNameResolver.cs is registered. This class provides a default implementation that returns the file name from the file path.
Once a custom file name resolver is registered, the resolved file name will be used in the UI and when downloading files.
Search Term Resolution
To pass a search term that you would like to highlight automatically you can implement ISearchTermResolver
interface.
The following code demonstrates how to implement a custom search term resolver:
using GroupDocs.Viewer.UI.Api;
//...
public class MySearchTermResolver : ISearchTermResolver
{
public Task<string> ResolveSearchTermAsync(string filepath)
{
return Task.FromResult("review");
}
}
Once the custom search term resolver is implemented, it can be registered during the application composition stage.
The following code snippet shows how to register a custom service as a singleton:
using GroupDocs.Viewer.UI.Api;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<ISearchTermResolver, MySearchTermResolver>();
NOTE: This feature works only when rendering to HTML and when PreloadPages
is set to 0
which means all the pages are preloaded. The service should be registered before you register the self-hosted or cloud API for it to take effect. By default, SearchTermResolver.cs is registered. This class provides a default implementation that returns an empty string.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- GroupDocs.Viewer.UI.Core (>= 8.1.1)
-
net8.0
- GroupDocs.Viewer.UI.Core (>= 8.1.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on GroupDocs.Viewer.UI.Api:
Package | Downloads |
---|---|
GroupDocs.Viewer.UI.SelfHost.Api
GroupDocs.Viewer.UI.SelfHost.Api containing API implementation that is based on GroupDocs.Viewer for .NET see https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET-UI for more details. |
|
GroupDocs.Viewer.UI
GroupDocs.Viewer.UI is a ASP.NET Core UI viewer of GroupDocs.Viewer for .NET see https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET-UI for more details. |
|
GroupDocs.Viewer.UI.Cloud.Api
GroupDocs.Viewer.UI.Cloud.Api containing API implementation that is based on GroupDocs.Viewer for .NET see https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET-UI for more details. |
|
GroupDocs.Viewer.UI.SelfHost.Api.CrossPlatform
GroupDocs.Viewer.UI.SelfHost.Api.CrossPlatform containing API implementation that is based on GroupDocs.Viewer for .NET cross-platform version see https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET-UI for more details. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
8.1.1 | 220 | 9/21/2025 |
8.0.7 | 429 | 5/23/2025 |
8.0.6 | 330 | 5/5/2025 |
8.0.5 | 303 | 4/23/2025 |
8.0.4 | 319 | 4/22/2025 |
8.0.3 | 281 | 4/4/2025 |
8.0.2 | 298 | 2/6/2025 |
8.0.1 | 303 | 12/20/2024 |
8.0.0 | 260 | 12/16/2024 |
6.0.12 | 450 | 12/2/2024 |
6.0.11 | 279 | 11/7/2024 |
6.0.10 | 314 | 9/30/2024 |
6.0.9 | 5,144 | 6/11/2024 |
6.0.8 | 1,202 | 4/1/2024 |
6.0.7 | 6,558 | 6/29/2023 |
6.0.6 | 325 | 6/29/2023 |
6.0.5 | 742 | 4/5/2023 |
6.0.4 | 566 | 3/30/2023 |
6.0.3 | 458 | 3/26/2023 |
6.0.2 | 731 | 1/31/2023 |
6.0.1 | 4,179 | 1/28/2023 |
6.0.0 | 1,385 | 7/23/2022 |
3.1.9 | 1,374 | 7/17/2022 |
3.1.8 | 1,752 | 7/4/2022 |
3.1.7 | 1,084 | 6/21/2022 |
3.1.6 | 1,747 | 6/2/2022 |
3.1.5 | 1,153 | 5/21/2022 |
3.1.4 | 1,704 | 3/17/2022 |
3.1.3 | 1,678 | 11/18/2021 |
3.1.2 | 754 | 10/21/2021 |
3.1.1 | 947 | 9/20/2021 |
3.1.0 | 1,000 | 7/9/2021 |