PdfFont.RemoveUnusedGlyphs Method

Removes unused glyphs from the font.

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)


public bool RemoveUnusedGlyphs()
Public Function RemoveUnusedGlyphs As Boolean

Return Value

Type: Boolean
true if unused glyphs were successfully removed from the font; otherwise, false


This method might fail to remove unused glyphs in the following cases:

  • Font is not embedded. For such fonts the Embedded property is false.
  • Font is used in a PdfTextBox or PdfComboBox and therefore all font glyphs should be preserved. A PDF reader or editor might be unable to change text in a control if some glyphs are missed in the font.
  • Font is of an unsupported type. For now, only TrueType fonts, created with AddFont() method are supported.

This method is useful for decreasing size of produced PDF documents. The method creates a font subset with used glyphs only and embeds the subset in the current document.

A glyph is treated as used if current document contains character drawn with the glyph.

This method does not remove unused glyphs from Type1 fonts and from any fonts in existing PDF documents.

See Also