Components for Developers
© 2000-2008, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Fonts
Collapse All

Gets or sets the style for embedded fonts in the current document.

Syntax

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

Remarks

FontEmbedStyle gets or sets the style for embedded fonts in the current document. Using font embedding styles, instead of direct font naming, can decrease the size of the generated PDF document.

Example

Embeding a font in 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

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2008, Two Pilots