Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
PDF Creator Pilot 4 Knowledge Base
How to Write Text in a PDF Document

See Also
Collapse All

With the following steps, you can see how to easily manipulate text using PDF Creator Pilot 4.

1. Choose a color using the SetColor method, for example. Also, choose a line width with for the new text using SetLineWidth. You can also set character spacing and word spacing and text rendering mode.

Delphi :

PDF.SetColor(0, 0, 0, 0);
PDF.SetLineWidth(1);
PDF.SetCharacterSpacing(0.5);
PDF.SetWordSpacing(-0.6);

Visual Basic or Visual Basic Script :

PDF.SetColor 0, 0, 0, 0
PDF.SetLineWidth 1 
PDF.SetCharacterSpacing 0.5 
PDF.SetWordSpacing -0.6 

C/C++ :

PDF->SetColor(0, 0, 0, 0);
PDF->SetLineWidth(1);
PDF->SetCharacterSpacing(0.5f);
PDF->SetWordSpacing(-0.6f);

C# :

PDF.SetColor(0, 0, 0, 0);
PDF.SetLineWidth(1);
PDF.SetCharacterSpacing(0.5f);
PDF.SetWordSpacing(-0.6f);

2. Select a font and set the name, style, weight, and character set for the new text string. You may select one of the system fonts (AddFont method), or a font from file (AddFontFromFile method), or one of the standard 14 fonts (AddBuiltInFont method). After you have added a font, use it by calling the UseFont method.

The sample below creates text with a Georgia font, size 14, in the default character set, italic style.

Delphi :

fnt := PDF.AddFont('Georgia', false, true, false, false, fcDefault);
PDF.UseFont(fnt, 14); 

Visual Basic or Visual Basic Script :

fnt = PDF.AddFont("Georgia", false, true, false, false, 1) 'fcDefault = 1
PDF.UseFont(fnt, 14); 

C/C++ :

long fnt = PDF->AddFont("Georgia", false, true, false, false, fcDefault)
PDF->UseFont(fnt, 14);

C# :

long fnt = PDF.AddFont("Georgia", false, true, false, false, FontCharset.fcDefault)
PDF.UseFont(fnt, 14);

3. Place your text string at specific coordinates or all wrapped in a box.

Delphi :

PDF.ShowTextAt(10, 40, 'Simple test');
PDF.ShowText('Other text.');

Visual Basic or Visual Basic Script :

PDF.ShowTextAt 10, 40, "Simple test" 
PDF.ShowText "Other text."

C/C++ :

PDF->ShowTextAt(10, 40, "Simple test");
PDF->ShowText("Other text.");

C# :

PDF.ShowTextAt(10, 40, "Simple test");
PDF.ShowText("Other text.");

See Text methods for more details.

See Also

Reference

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots