Skip to content

Commit

Permalink
908087: Embed Segoe UI Emoji Fonts in SfPdfViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
sinthiyakalimuthu committed Sep 19, 2024
1 parent 9a9e8bb commit b16e0a0
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@

<SfPdfViewer2 @ref="pdfViewerRef"
DocumentPath="@DocumentPath"
FallbackFontCollection="@fontCollection"
Height="100%"
Width="100%">
<PdfViewerEvents Created="@Created"></PdfViewerEvents>
</SfPdfViewer2>

@code {
SfPdfViewer2 pdfViewerRef;
private string DocumentPath { get; set; } = "wwwroot/Data/FontCollection.pdf";
// Create a new dictionary for fallback fonts
Dictionary<string, Stream> fontCollection = new Dictionary<string, Stream>();

protected override void OnInitialized()
public void Created()
{
Stream font = new MemoryStream(System.IO.File.ReadAllBytes("wwwroot/seguiemj.ttf"));
// Add the Segoe UI Emoji font to the fallback collection
fontCollection.Add("seguiemj", font);
pdfViewerRef.FallbackFontCollection.Add("seguiemj", font);
}
}

0 comments on commit b16e0a0

Please sign in to comment.