FontEmbedStyle
IPDFDocument4 :: General document management :: Fonts

See Also Example
Collapse All

This property gets or sets the style for embedded fonts in the current document.

Syntax

EmbedStyle FontEmbedStyle { get; set; }
Value
One of theĀ EmbedStyle values.

Remarks

Using font embedding styles, instead of direct font naming, can decrease the size of the generated PDF document.

Example

Embedding a Font in a PDF Document

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.FontEmbedStyle := EmbedStyle.esNotEmbed;
{ If we embed all used fonts in document then file size will }
{ be larger but anyone will be able to view this document even }
{ without needed fonts installed in the system. }
fnt1 := PDF.AddBuiltInFont(bfHelveticaOblique, false, false);
fnt2 := PDF.AddFont('Arial', false, false, false, false, fcDefault);
PDF.UseFont(fnt1, 14);
PDF.ShowTextAt(20, 20, 'Text1.');
PDF.UseFont(fnt2, 14);
PDF.ShowTextAt(20, 40, 'Text2.');
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->FontEmbedStyle = esNotEmbed;
// If we embed all used fonts in document then file size will
// be larger but anyone will be able to view this document even
// without needed fonts installed in the system.
long fnt1 = PDF->AddBuiltInFont(bfHelveticaOblique, false, false);
long fnt2 = PDF->AddFont("Arial", false, false, false, false, fcDefault);
PDF->UseFont(fnt1, 14);
PDF->ShowTextAt(20, 20, "Text1.");
PDF->UseFont(fnt2, 14);
PDF->ShowTextAt(20, 40, "Text2.");
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.FontEmbedStyle = EmbedStyle.esNotEmbed;
// If we embed all used fonts in document then file size will
// be larger but anyone will be able to view this document even
// without needed fonts installed in the system.
long fnt1 = PDF.AddBuiltInFont(BuiltInFont.bfHelveticaOblique, false, false);
long fnt2 = PDF.AddFont("Arial", false, false, false, false, FontCharset.fcDefault);
PDF.UseFont(fnt1, 14);
PDF.ShowTextAt(20, 20, "Text1.");
PDF.UseFont(fnt2, 14);
PDF.ShowTextAt(20, 40, "Text2.");
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.FontEmbedStyle = 2 'EmbedStyle.esNotEmbed
' If we embed all used fonts in document then file size will
' be larger but anyone will be able to view this document even
' without needed fonts installed in the system.
fnt1 = PDF.AddBuiltInFont(9, false, false) 'BuiltInFont.bfHelveticaOblique
fnt2 = PDF.AddFont("Arial", false, false, false, false, 0) 'FontCharset.fcDefault
PDF.UseFont fnt1, 14
PDF.ShowTextAt 20, 20, "Text1."
PDF.UseFont fnt2, 14
PDF.ShowTextAt 20, 40, "Text2."
PDF.SaveToFile "test.pdf", true

See Also

Reference