WebOpenFont Constructors

Overloads

WebOpenFont(Stream)Initializes a new instance of WebOpenFont class.
WebOpenFont(String)Initializes a new instance of WebOpenFont class.

WebOpenFont(Stream)

Initializes a new instance of WebOpenFont class.

public WebOpenFont(Stream stream)
Public Sub New (stream As Stream)

Parameters

stream
Stream

Stream containing the web open font data.

Licensing Info

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

This example shows how to use the web open font.
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.Text;

public class Example
{
    public static void CreatePDF(string outputPath, string fontPath)
    {
        // Create a stream
        Stream stream = System.IO.File.OpenRead(fontPath);

        // Create a web open font. Setting true enables character shaping usage.
        WebOpenFont webOpenfont = new WebOpenFont(stream);

        // 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 label
        Label label = new Label("This text uses web open font", 0, 0, 300, 300);

        // Assign web open font to label
        label.Font = webOpenfont;

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

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

WebOpenFont(String)

Initializes a new instance of WebOpenFont class.

public WebOpenFont(string filePath)
Public Sub New (filePath As String)

Parameters

filePath
String

Physical file path of the web open font file.

Licensing Info

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

This example shows how to use the web open font.
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
using ceTe.DynamicPDF.Text;

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

        // Create a Page and add it to the document
        Page page = new Page();
        document.Pages.Add(page);

        // Create a web open font
        WebOpenFont webOpenfont = new WebOpenFont(fontPath);

        //Create a label
        Label label = new Label("This text uses web opent font ", 0, 0, 300, 300);

        // Assign web open font to label
        label.Font = webOpenfont;

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

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

See Also

WebOpenFont
ceTe.DynamicPDF.Text

In this topic