Change the font family for type signatures in ASP.NET Core
Change the font family for Type Signature and Initial fields by adding a stylesheet to load fonts and assigning them via the PDF Viewer settings. Include Google Font links in the HTML head to use those fonts.
Signature field property
The PDF Viewer supports changing fonts for Signature and Initial fields using the typeSignatureFonts and typeInitialFonts properties.
Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.
Step 2: Use the following code to apply custom fonts to the Signature field.
```html
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Allura" >
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Sacramento">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inspiration">
```
<div style="width:100%;height:600px">
<ejs-pdfviewer id="pdfviewer"
style="height:600px"
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf">
</ejs-pdfviewer>
</div>
<script>
function changeFontFamily()
{
var pdfviewer=document.getElementById('pdfviewer').ej2_instances[0];
pdfviewer.SignatureFieldSettings.typeSignatureFonts = [
'Allura',
'Tangerine',
'Sacramento',
'Inspiration',
];
}
</script>Initial field property
Use the following code to apply custom fonts to the Initial field.
```html
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Allura" >
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Sacramento">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inspiration">
```
<div style="width:100%;height:600px">
<ejs-pdfviewer id="pdfviewer"
style="height:600px"
documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf">
</ejs-pdfviewer>
</div>
<script>
function changeFontFamily()
{
var pdfviewer=document.getElementById('pdfviewer').ej2_instances[0];
pdfviewer.InitialFieldSettings.typeInitialFonts = [
'Allura',
'Tangerine',
'Sacramento',
'Inspiration',
];
}
</script>By implementing this configuration, custom fonts can be used for both Signature and Initial form fields.