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.

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

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

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

function AddTrueTypePDFText($FromPage,
                            $ToPage,
                            $Left,
                            $Top,
                            $Text,
                            $Font,
                            $FontSize,
                            $FontEmbedding,
                            $Color) 

BclPrcResult AddTrueTypePDFText(BclPDFProcessorHandle* pHandle,
                                int FromPage,
                                int ToPage,
                                double Left,
                                double Top,
                                const wchar_t* Text,
                                const wchar_t* Font,
                                double FontSize,
                                BclPrcFontEmbedding FontEmbedding,
                                BclColor Color);
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)

bepproc +Text -text <string>
              [-left <dimension>]
              [-top <dimension>]
              [-pages <from>-<to> | -page <int>]
              [-font <string>]
              [-size <float>]
              [-embed none|subset|fullset]
              [-color <color>]


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();