TextArea.GetKerningValues
Gets the Kerning values.
public KerningValues GetKerningValues()
Function GetKerningValues() As KerningValues
Returns
KerningValues The kerning values.
Licensing Info
This method 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.
Exceptions
GeneratorException If KerningEnabled is set to false.
Examples
The following example demonstrates how to apply custom kerning.Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Text
Imports ceTe.DynamicPDF.PageElements
Module Module1
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a PDF Page
Dim MyPage As Page = New Page
' Create a Text Area
Dim MyTextArea As TextArea = New TextArea("Text with kerning", 10, 10, 200, 100)
' Enable the kerning for the text area
MyTextArea.KerningEnabled = True
' Get the Kerning Pairs for the text area
Dim MyKerningValues As KerningValues = MyTextArea.GetKerningValues
' Apply a custom kerning value between 'T' & 'e' in 'Text'
' so that chars will be closer than normal
MyKerningValues.Spacing(0) = 200
' Add the text area to the page
MyPage.Elements.Add(MyTextArea)
' Add the page to the document
MyDocument.Pages.Add(MyPage)
' Save the document
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 PDF Page
Page page = new Page();
// Create a Text Area
TextArea textArea = new TextArea("Text with kerning", 10, 10, 200, 100);
// Enable the kerning for the text area
textArea.KerningEnabled = true;
// Get the Kerning Pairs for the text area
KerningValues kerningValues = textArea.GetKerningValues();
// Apply a custom kerning value between 'T' & 'e' in 'Text'
// so that chars will be closer than normal
kerningValues.Spacing[0] = 200;
// Add the text area to the page
page.Elements.Add(textArea);
// Add the page to the document
document.Pages.Add(page);
// Save the document
document.Draw(outputPath);
}
}