Skip to content

Commit e0e0575

Browse files
Merge branch 8.1.2 into main (#76)
* Turn of thumbs creation in image mode * Fix print issues, rely only on own fonts, option to disable pages scroll animation
1 parent 64a2b16 commit e0e0575

File tree

13 files changed

+113
-1105
lines changed

13 files changed

+113
-1105
lines changed

src/GroupDocs.Viewer.UI.API/Controllers/ViewerController.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ private async Task<List<PageData>> CreateViewDataPagesAndThumbs(FileCredentials
332332
{
333333
await _viewer.GetPagesAsync(file, pagesToCreate);
334334

335-
if (_config.EnableThumbnails)
335+
if (_config.EnableThumbnails && _config.RenderingMode == RenderingMode.Html)
336336
{
337337
await _viewer.GetThumbsAsync(file, pagesToCreate);
338338
}
@@ -346,7 +346,7 @@ private async Task<List<PageData>> CreateViewDataPagesAndThumbs(FileCredentials
346346
var pageUrl = _apiUrlBuilder.BuildPageUrl(file.FilePath, page.Number, _viewer.PageExtension);
347347
var thumbUrl = _apiUrlBuilder.BuildThumbUrl(file.FilePath, page.Number, _viewer.PageExtension);
348348

349-
var pageData = _config.EnableThumbnails
349+
var pageData = _config.EnableThumbnails && _config.RenderingMode == RenderingMode.Html
350350
? new PageData(page.Number, page.Width, page.Height, pageUrl, thumbUrl)
351351
: new PageData(page.Number, page.Width, page.Height, pageUrl);
352352

@@ -366,7 +366,6 @@ private async Task<List<PageData>> CreateViewDataPages(FileCredentials file, Doc
366366
{
367367
await _viewer.GetPagesAsync(file, pagesToCreate);
368368

369-
370369
var pages = new List<PageData>();
371370
foreach (PageInfo page in docInfo.Pages)
372371
{
@@ -392,7 +391,7 @@ private async Task<List<PageData>> CreatePagesAndThumbs(FileCredentials file, Do
392391
{
393392
await _viewer.GetPagesAsync(file, pagesToCreate);
394393

395-
if (_config.EnableThumbnails)
394+
if (_config.EnableThumbnails && _config.RenderingMode == RenderingMode.Html)
396395
{
397396
await _viewer.GetThumbsAsync(file, pagesToCreate);
398397
}
@@ -404,7 +403,7 @@ private async Task<List<PageData>> CreatePagesAndThumbs(FileCredentials file, Do
404403
var pageUrl = _apiUrlBuilder.BuildPageUrl(file.FilePath, page.Number, _viewer.PageExtension);
405404
var thumbUrl = _apiUrlBuilder.BuildThumbUrl(file.FilePath, page.Number, _viewer.ThumbExtension);
406405

407-
var pageData = _config.EnableThumbnails
406+
var pageData = _config.EnableThumbnails && _config.RenderingMode == RenderingMode.Html
408407
? new PageData(page.Number, page.Width, page.Height, pageUrl, thumbUrl)
409408
: new PageData(page.Number, page.Width, page.Height, pageUrl);
410409

src/GroupDocs.Viewer.UI.API/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,27 @@ builder.Services.AddSingleton<ISearchTermResolver, MySearchTermResolver>();
126126
![GroupDocs.Viewer.UI - Custom search term](https://raw.githubusercontent.com/groupdocs-viewer/groupdocs-viewer.github.io/master/resources/image/ui/custom-search-term.png)
127127

128128
**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](./SearchTermResolution/Implementation/SearchTermResolver.cs) is registered. This class provides a default implementation that returns an empty string.
129+
130+
### Controll Thumbnails Creation
131+
132+
Thumbnails are only required when rendering to HTML with embedded or external resources.
133+
When rendering to JPG or PNG, the actual page image is used as a thumbnail for better performance.
134+
135+
To control thumbnail creation when rendering to HTML, set the `EnableThumbnails` property to `false`.
136+
This hides the thumbnail panel and disables thumbnail generation by the API.
137+
138+
The following code demonstrates how to use this option without a UI:
139+
140+
```cs
141+
builder.Services
142+
.AddOptions<Config>()
143+
.Configure<IConfiguration>((config, configuration) =>
144+
{
145+
config.EnableThumbnails = false;
146+
});
147+
148+
builder.Services
149+
.AddControllers()
150+
.AddGroupDocsViewerSelfHostApi(config =>
151+
//...
152+
```

src/GroupDocs.Viewer.UI.Core/Configuration/Config.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ public class Config
6464
/// </summary>
6565
public bool EnableHyperlinks { get; set; } = true;
6666

67+
/// <summary>
68+
/// Enables or disables scroll animation when navigating to a page using page seclector control.
69+
/// Default value: <c>true</c> and the scroll animation is enabled.
70+
/// </summary>
71+
public bool EnableScrollAnimation { get; set; } = true;
72+
6773
/* Control Visibility Settings */
6874

6975
/// <summary>

src/GroupDocs.Viewer.UI/App/3rdpartylicenses.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,7 @@ https://github.com/cartant/rxjs-etc by Nicholas Jamieson, MIT licensed. See the
871871
file header for details.
872872

873873
--------------------------------------------------------------------------------
874-
Package: @ngx-translate/core
875-
License: "MIT"
876-
877-
878-
--------------------------------------------------------------------------------
879-
Package: @ngrx/operators
874+
Package: @ngrx/effects
880875
License: "MIT"
881876

882877
The MIT License (MIT)
@@ -906,7 +901,12 @@ https://github.com/cartant/rxjs-etc by Nicholas Jamieson, MIT licensed. See the
906901
file header for details.
907902

908903
--------------------------------------------------------------------------------
909-
Package: @ngrx/effects
904+
Package: @ngx-translate/core
905+
License: "MIT"
906+
907+
908+
--------------------------------------------------------------------------------
909+
Package: @ngrx/operators
910910
License: "MIT"
911911

912912
The MIT License (MIT)

src/GroupDocs.Viewer.UI/App/chunk-ZIHOBMJY.js renamed to src/GroupDocs.Viewer.UI/App/chunk-2M445E45.js

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GroupDocs.Viewer.UI/App/chunk-3SMDAA4S.js

Lines changed: 0 additions & 446 deletions
This file was deleted.

src/GroupDocs.Viewer.UI/App/chunk-INJWMVGV.js renamed to src/GroupDocs.Viewer.UI/App/chunk-LEH4MZQX.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)