Acrobat reader supports 14 PDF core fonts. Developers don't need to embed these fonts in any PDF file while working with Aspose.Pdf . These 14 fonts are:
If developers need to use any of these fonts in their PDF files using Aspose.Pdf then only their font name should be assigned as a string to TextInfo.FontName property of the Segment .
Note: The default font is Times-Roman.
The 14 core fonts are shown in the following figure:
|
Note: Symbol and ZapfDingbats are symbol fonts.
An example is given below to demonstrate the use of Symbol font.
Code Snippet
[C#]
//Instantiate Pdf instance by calling it empty constructor
Pdf pdf1 = new Pdf();
//Create a section in the Pdf object
Section sec1 = pdf1.Sections.Add();
//Create a text paragraph inheriting text format settings from the section
Text text1 = new Text(sec1);
//Add the text paragraph to the section
sec1.Paragraphs.Add(text1);
//Create 1st text segment
Segment s1 = new Segment(((char)183).ToString());
//Set the font name to the TextInfo.FontName property of segment
s1.TextInfo.FontName = "Symbol";
//Add 1st text segment to the text paragraph
text1.Segments.Add(s1);
//Create 2nd text segment
Segment s2 = new Segment(" the first item");
//Add 2nd text segment to the text paragraph
text1.Segments.Add(s2);
//Save the Pdf
pdf1.Save("Symbol.pdf");
[VB.NET]
'Instantiate Pdf instance by calling it empty constructor
Dim pdf1 As Pdf = New Pdf()
'Create a section in the Pdf object
Dim sec1 As Section = pdf1.Sections.Add()
'Create a text paragraph inheriting text format settings from the section
Dim text1 As Aspose.Pdf.Text = New Aspose.Pdf.Text(sec1)
'Add the text paragraph to the section
sec1.Paragraphs.Add(text1)
'Create 1st text segment
Dim s1 As Segment = New Segment(Microsoft.VisualBasic.ChrW(183).ToString())
'Set the font name to the TextInfo.FontName property of segment
s1.TextInfo.FontName = "Symbol"
'Add 1st text segment to the text paragraph
text1.Segments.Add(s1)
'Create 2nd text segment
Dim s2 As Segment = New Segment(" the first item")
'Add 2nd text segment to the text paragraph
text1.Segments.Add(s2)
'Save the Pdf
pdf1.Save("Symbol.pdf")
[JAVA]
//Instantiate Pdf instance by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
Section sec1 = pdf1.getSections().add();
//Create a text paragraph inheriting text format settings from the section
Text text1 = new Text(sec1);
//Add the text paragraph to the section
sec1.getParagraphs().add(text1);
//Create 1st text segment
Segment s1 = new Segment(text1, String.valueOf((char)183));
//Set the font name to the TextInfo.FontName property of segment
s1.getTextInfo().setFontName("Symbol");
//Add 1st text segment to the text paragraph
text1.getSegments().add(s1);
//Create 2nd text segment
Segment s2 = new Segment(text1, " the first item");
//Add 2nd text segment to the text paragraph
text1.getSegments().add(s2);
//Save the Pdf
FileOutputStream out = new FileOutputStream(new File("..."));
pdf1.save(out);
[XML]
<Pdf xmlns="Aspose.Pdf">
<Section>
<Text>
<Segment FontName="Symbol">·</Segment>
<Segment>the first item</Segment>
</Text>
</Section>
</Pdf>