KerningValues
Represents a kerning value collection.
public class KerningValues
Public Class KerningValues
Inheritance: ObjectKerningValues
Licensing Info
This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example will display text on the page.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.Text
Module MyModule
Sub Main()
' 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
' Add page to the document
MyDocument.Pages.Add(MyPage)
' Assign some text to a string
Dim MyText As String = "To and WA are examples of when kerning would be used."
' Create a textarea
Dim MyTextArea As TextArea = New TextArea(MyText, 10, 10, 400, 700, ceTe.DynamicPDF.Font.TimesRoman)
' Must be enabled before kern values can be read
MyTextArea.KerningEnabled = true
' Create a KerningValues
Dim MyKernValues As KerningValues = MyTextArea.GetKerningValues()
' Assign positive value for making the space between chars closer and negative value for making the space further
For i As Integer = 0 To MyKernValues.Spacing.Length - 1
MyKernValues.Spacing(i) = Short.Parse((MyKernValues.Spacing(i) - 400).ToString)
Next
' Add the text to the page
MyPage.Elements.Add(MyTextArea)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Text;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
// Add page to the document
document.Pages.Add(page);
//Assign some text to a string
string text = "To and WA are examples of when kerning would be used.";
// Create a textarea
TextArea textArea = new TextArea(text, 10, 10, 400, 700, ceTe.DynamicPDF.Font.TimesRoman);
// Must be enabled before kern values can be read
textArea.KerningEnabled = true;
// Create a KerningValues
KerningValues kernValues = textArea.GetKerningValues();
// Assign positive value for making the space between chars closer and negative value for making the space further
for (int i = 0; i < kernValues.Spacing.Length; i++)
{
kernValues.Spacing[i] = (short)(kernValues.Spacing[i] - 400);
}
// Add the text area to the page
page.Elements.Add(textArea);
// Save the PDF
document.Draw(outputPath);
}
}
Properties
Spacing | Gets the spacing array corresponding to the text array. |
Text | Gets the character array of the text that is kerned. |
Methods
Equals(Object) | Determines whether the specified Object is equal to the current Object . (Inherited from Object) |
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) |