BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

AddTrueTypePDFText() Method

Adds a TrueType text entity to the PDF document's content.

Sub AddTrueTypePDFText(FromPage As Long,
                        ToPage As Long,
                        Left As Double,
                        Top As Double,
                        Text As String,
                        Font As String,
                        FontSize As Double,
                        FontEmbedding As prcFontEmbedding,
                        Color As OLE_COLOR)

void AddTrueTypePDFText(int FromPage,
                         int ToPage,
                         double Left,
                         double Top,
                         String Text,
                         String Font,
                         double FontSize,
                         prcFontEmbedding FontEmbedding,
                         System.UInt32 Color)

void AddTrueTypePDFText(int FromPage,
                         int ToPage,
                         double Left,
                         double Top,
                         string Text,
                         string Font,
                         double FontSize,
                         prcFontEmbedding FontEmbedding,
                         int Color) throws PDFProcessorException

Parameters

Return Values

N/A.

Remarks

Note 1: The page number uses a zero-based index, meaning that page numbering starts from 0.

Note 2: If Text contains Unicode characters, then font embedding is required. In this case, if FontEmbedding is PRC_FONT_EMBED_NONE (i.e. none), easyPDF SDK automatically overrides it to be PRC_FONT_EMBED_SUBSET (i.e. subset).

Note 3: OLE_COLOR conversion from various programming languages:

C++:

static_cast<OLE_COLOR>(RGB(0, 0, 255))

VB6:

RGB(0, 0, 255)

VB.NET:

Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

C#:

(uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))

Others:

32 bit integer value in following format: 0x00bbggrr (in BGR format, not in RGB)

For more information about color translation, refer to MSDN Knowledge Base article Q131101.

Example Usage in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf")

oProcessorHandle.AddTrueTypePDFText 0, _
                                    1, _
                                    2.0, _
                                    2.0, _
                                    "Added with AddTrueTypePDFText()", _
                                    "Arial", _
                                    16, _
                                    PRC_FONT_EMBED_FULLSET, _
                                    RGB(0, 0, 255)
                                                                        
oProcessorHandle.Close

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\output.pdf")

oProcessorHandle.AddTrueTypePDFText(0, _
                                    1, _
                                    2.0, _
                                    2.0, _
                                    "Added with AddTrueTypePDFText()", _
                                    "Arial", _
                                    16.0, _
                                    prcFontEmbedding.PRC_FONT_EMBED_FULLSET, _
                                    Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))))
                                                                           
oProcessorHandle.Close()

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\output.pdf", null);

oProcessorHandle.AddTrueTypePDFText(0, 
                                    1, 
                                    2.0, 
                                    2.0, 
                                    "Added with AddTrueTypePDFText()", 
                                    "Arial", 
                                    16.0, 
                                    prcFontEmbedding.PRC_FONT_EMBED_FULLSET, 
                                    (uint)System.Drawing.ColorTranslator.ToOle(Color.FromArgb(0, 0, 255)));
                                                                           
oProcessorHandle.Close();