Sometimes you need custom fonts to use your creativity to create or edit a PDF document, which is not possible with the default fonts. With DsPdfViewer, you can add and use a list of new or custom fonts using registerFont method and editorDefaults.fontNames option.
Refer to the following example code to register and add custom fonts to DsPdfViewer:
JS |
Copy Code
|
---|---|
// Register custom fonts. viewer.registerFont("BudmoJiggler-Regular", "/assets/budmo_jiggler.ttf"); viewer.registerFont("FantaisieArtistique", "/assets/FantaisieArtistique.ttf"); // Set editor defaults for free text annotation. viewer.options.editorDefaults.freeTextAnnotation = { fontName: 'FantaisieArtistique', borderStyle: { width: 0 } }; // Add font names. viewer.options.editorDefaults.fontNames = [ { name: 'Disco font', value: 'BudmoJiggler-Regular' }, { name: 'Fantaisie font', value: 'FantaisieArtistique' } ]; |