Using Character Shaping in PDF (.NET Core/Framework)
Using Character Shaping in PDF using DynamicPDF Generator is simple and easy. Character Shaping or Complex Text Layout (CTL) is the selection of the required shape of a character based on that character’s position within a word and its surrounding characters.
How to use Character Shaping in PDF in C#
Below are the steps and sample code illustrating using Character Shaping in a PDF document using DynamicPDF Core Suite.
Steps for Using Character Shaping in a PDF Document
- Create a
Document
object. - Create a
Page
object and add it to the Document instance. - Create a
OpenTypeFont
object and provide the font file name with complete path in the constructor. - Create a
TextArea
object and assign the font. - Add the
TextArea
page element to the Page object. - Save the PDF document.
Sample Code - C#
Document document = new Document();
Page page = new Page();
document.Pages.Add(page);
OpenTypeFont charShapingFont = new OpenTypeFont("MyFont.ttf", true); // path to .ttf or .otf file
TextArea area = new TextArea("Text requiring character shaping", 0, 0, 300, 30, charShapingFont, 18);
page.Elements.Add(area);
document.Draw(@"C:\Output.pdf");
Over 75 Page Elements
DynamicPDF Core Suite contains over 75 page elements you can use to add rich content to the PDFs you create. DynamicPDF Core suite includes elements for:
- Images,
- Text Objects (TextArea and Label),
- HTML,
- Barcodes (47 types),
- Form Fields,
- and Charts.
Getting Started
NuGet Package
DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET
package. The easiest way to install is through the Visual Studio Package Manager, but you can also download directly if preferred.
DynamicPDF Core Suite Information
More information can be found at the DynamicPDF Core Suite website.
Available on Other Platforms
DynamicPDF Core Suite is also available for the following platforms. Refer to the respective product pages for more details.
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX