Skip to content

Commit 511e2ce

Browse files
Merge pull request #4646 from syncfusion-content/897381_docCO
897381: Documentation for CustomFonts and OverscanCount
2 parents b72842f + d6a8325 commit 511e2ce

File tree

4 files changed

+84
-0
lines changed

4 files changed

+84
-0
lines changed

blazor-toc.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,6 +3598,8 @@
35983598
<li> <a href="/blazor/pdfviewer-2/how-to/deploy-maui-using-android-emulator">Render PDF document from embedded source in the MAUI Android app</a></li>
35993599
<li> <a href="/blazor/pdfviewer-2/how-to/improve-performance-using-CDN">Improve the performance using CDN in Blazor SfPdfViewer Component</a></li>
36003600
<li> <a href="/blazor/pdfviewer-2/how-to/processing-large-files-without-increasing-maximum-message-size">Processing Large Files Without Increasing Maximum Message Size in SfPdfViewer Component</a></li>
3601+
<li> <a href="/blazor/pdfviewer-2/how-to/load-custom-font-pdfium">Load Custom Fonts in a PDF Viewer</a></li>
3602+
<li> <a href="/blazor/pdfviewer-2/how-to/optimize-scroll-overscan-count">Optimize PDF Scrolling with the OverscanCount</a></li>
36013603
</ul>
36023604
</li>
36033605
<li>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: post
3+
title: Load Custom Fonts in a PDF Viewer | Syncfusion
4+
description: Learn here all about Custom Fonts in Blazor application in Syncfusion Blazor SfPdfViewer component and more.
5+
platform: Blazor
6+
control: SfPdfViewer
7+
documentation: ug
8+
---
9+
10+
# Load Custom Fonts in a PDF Viewer
11+
12+
Syncfusion Blazor PDF Viewer utilizes Pdfium to extract the text and convert the PDF document as images. Pdfium supports a limited set of fonts by default. To expand this capability, [CustomFonts](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_CustomFonts) can be used to load additional fonts that are not embedded within Pdfium.
13+
14+
To implement CustomFonts, follow these steps:
15+
16+
1. Upload the font files you want to use into the `wwwroot` folder of your project.
17+
18+
2. Include the exact paths to these font files in the customFonts list for proper referencing. This ensures that Pdfium can utilize these fonts as needed.
19+
20+
![CustomFonts in Blazor PDFViewer](../../pdfviewer/images/customfont-files.png)
21+
22+
The following code demonstrates how to load the CustomFonts to PDF Viewer.
23+
24+
```cshtml
25+
26+
<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
27+
Height="100%"
28+
Width="100%" CustomFonts="@customFonts">
29+
</SfPdfViewer2>
30+
31+
32+
@code {
33+
34+
public List<string> customFonts = new List<string> { "wwwroot/SIMSUN.TTC", "wwwroot/SIMSUNB.TTF"}
35+
36+
}
37+
38+
```
39+
Below code snippet illustrates how to load a CustomFonts using a CDN link.
40+
41+
```cshtml
42+
43+
<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
44+
Height="100%"
45+
Width="100%" CustomFonts="@customFonts">
46+
</SfPdfViewer2>
47+
48+
49+
@code {
50+
51+
public List<string> customFonts = new List<string> { "https://cdn.jsdelivr.net/npm/arial-geo-bold@1.0.0/fonts/arial-geo-bold-webfont.ttf" };
52+
53+
}
54+
55+
```
56+
[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20CustomFonts%20pdfium).
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
layout: post
3+
title: Optimize PDF Scrolling with the OverscanCount | Syncfusion
4+
description: Learn here all about OverscanCount in Blazor application in Syncfusion Blazor SfPdfViewer component and more.
5+
platform: Blazor
6+
control: SfPdfViewer
7+
documentation: ug
8+
---
9+
10+
# Optimize PDF Scrolling with the OverscanCount
11+
12+
The [OverscanCount](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.SfPdfViewer.PdfViewerBase.html#Syncfusion_Blazor_SfPdfViewer_PdfViewerBase_OverscanCount) feature in a PDF Viewer allows users to preload a specified number of pages before and after the visible view port when opening a PDF document, thereby enhance the scrolling experience.
13+
14+
To utilize this capability in Syncfusion PDF Viewer, adjust the OverscanCount property. By setting this property to a desired number, users can preload pages adjacent to the active page. This ensures quicker access to specific pages without waiting for the entire document to load.
15+
16+
Below is a code snippet illustrating how to implement the OverscanCount:
17+
18+
```cshtml
19+
20+
<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
21+
Height="100%"
22+
Width="100%" OverscanCount="10">
23+
</SfPdfViewer2>
24+
25+
```
26+
[View sample in GitHub](https://github.com/SyncfusionExamples/blazor-pdf-viewer-examples/tree/master/Load%20and%20Save/Load%20OverscanCount).
29.1 KB
Loading

0 commit comments

Comments
 (0)