OpenTypeFontCollection

Represents an OpenType font collection.

public class OpenTypeFontCollection
Public Class OpenTypeFontCollection

Inheritance: ObjectOpenTypeFontCollection

Examples

This example shows how to use the True Type Font Collection(TTC) font file.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.Text

Module MyModule

    Sub CreatePDF()

        ' Create a PDF Document
        Dim MyDocument As Document = New Document

        ' Create a Page and add it to the document
        Dim MyPage As Page = New Page
        MyDocument.Pages.Add(MyPage)

        'Create a TextArea
        Dim area As TextArea = New TextArea("Hello TTC Testing", 100, 100, 100, 100)

        'Create a open type font collection.
        Dim collection As OpenTypeFontCollection = New OpenTypeFontCollection("Path of .ttc file")

        'Assign opentype font to label from Collection using the Index
        area.Font = collection.GetFont(3)

        ' Add a label to the page
        MyPage.Elements.Add(area)

        ' Save the PDF document
        MyDocument.Draw("C:\MyDocument.pdf")

    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.Text;

public class Example
{
    public static void CreatePDF(string outputPath, string fontCollectionPath)
    {  
        // Create a PDF Document
        Document document = new Document();

        // Create a new Page
        Page page = new Page();

        // Add the page to the document
        document.Pages.Add(page);

        //Create a TextArea
        TextArea area = new TextArea("Hello TTC Testing", 100, 100, 100, 100);

		//Create a open type font collection.
        OpenTypeFontCollection collection = new OpenTypeFontCollection(fontCollectionPath);
		
        //Assign opentype font to label from Collection using the Index
        area.Font = collection.GetFont(3);

        // Add label to the page
        page.Elements.Add(area);

        // Save the PDF document
        document.Draw(outputPath);
    }
}

Constructors

OpenTypeFontCollection(Stream)Intializes a new instance of OpenTypeFont class.
OpenTypeFontCollection(String)Initializes a new instance of OpenTypeFontCollection class.

Methods

Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetFont(Int32)Gets the font from the Open type collection based on the index.
GetFont(String)Gets the font from the Open type collection based on the font name.
GetFontNames()Gets the names of the fonts present in the open type collection.
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.Text

In this topic