DynaPDF.ChangeFont
------------------

This function changes or sets the font to the one of the parameter FontHandle.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.1](newinversion31.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.ChangeFont"; PDF; FontHandle ) 

**MBS**( **"DynaPDF.ChangeFont"** /\* This function changes or sets the font to the one of the parameter FontHandle. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$FontHandle**) /\* Handle of the new font. e.g. $font \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| FontHandle | Handle of the new font. | $font |

### Result

Returns OK or error message.

### Description

This function changes or sets the font to the one of the parameter FontHandle.   
FontHandle must be a valid font handle that was returned by [DynaPDF.SetFont](DynaPDFSetFont.md), [DynaPDF.SetFontEx](DynaPDFSetFontEx.md), DynaPDF.SetCIDFont, or DynaPDF.LoadFont.  
The font size is taken from the current font if any. If no font is active when the function is called, the font size will be set to the value that was used to load font the last time.  
See also [ChangeFont](https://www.monkeybreadsoftware.com/DynaPDF-Manual/ChangeFont.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.ChangeFontEx](DynaPDFChangeFontEx.md)
- [DynaPDF.ChangeFontSize](DynaPDFChangeFontSize.md)
- [DynaPDF.ChangeFontStyle](DynaPDFChangeFontStyle.md)
- [DynaPDF.ChangeFontStyleEx](DynaPDFChangeFontStyleEx.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetFont](DynaPDFSetFont.md)
- [DynaPDF.SetFontEx](DynaPDFSetFontEx.md)

### Release notes

- **Version 12.0**
    - Changed [DynaPDF.SetFont](https://www.mbsplugins.eu/DynaPDFSetFont.shtml), [DynaPDF.Table.SetFont](https://www.mbsplugins.eu/DynaPDFTableSetFont.shtml), [DynaPDF.SetFontEx](https://www.mbsplugins.eu/DynaPDFSetFontEx.shtml), [DynaPDF.ChangeFontEx](https://www.mbsplugins.eu/DynaPDFChangeFontEx.shtml), [DynaPDF.SetFieldFont](https://www.mbsplugins.eu/DynaPDFSetFieldFont.shtml) and [DynaPDF.SetBookmarkStyle](https://www.mbsplugins.eu/DynaPDFSetBookmarkStyle.shtml) functions to accept styles as text.
- **Version 11.2**
    - Added [DynaPDF.ChangeFontEx](https://www.mbsplugins.eu/DynaPDFChangeFontEx.shtml) function.

This function checks for a license.

Created 18th August 2014 , last changed 27th May 2017

  
[DynaPDF.ChangeBookmark](DynaPDFChangeBookmark.md) - [DynaPDF.ChangeFontEx](DynaPDFChangeFontEx.md)

[HTML Version](DynaPDFChangeFont.shtml)