Components for Developers
© 2000-2008, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Text
Collapse All

This method draws wrapped text bounded by a rectangle.

Syntax

HRESULT ShowTextAligned (
FLOAT left,
FLOAT top,
FLOAT right,
FLOAT bottom,
TextAlign align,
VerticalAlign verticalAlign,
BSTR text
)
Parameters
left
X coordinate of the top-left corner of the bounding rectangle

top
Y coordinate of the top-left corner of the bounding rectangle

right
X coordinate of the bottom-right corner of the bounding rectangle

bottom
Y coordinate of the bottom-right corner of the bounding rectangle

align
Horizontal alignment

verticalAlign
Vertical alignment

text
Text string to be displayed

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

This procedure draws an ASCII text line inside the bounding rectangle with top-left and bottom-right corners, and with the specified horizontal and vertical justifications.

Example

Drawing Wrapped, Aligned Text in a Box

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.DrawRectangle(100, 100, 140, 40, 0);
PDF.Stroke;
PDF.ShowTextAligned(100, 100, 240, 140, taLeft, vaTop, 'Here is long text in the box.');

PDF.DrawRectangle(100, 150, 140, 40, 0);
PDF.Stroke;
PDF.ShowTextAligned(100, 150, 240, 190, taCenter, vaCenter, 'Here is long text in the box.');

PDF.DrawRectangle(100, 200, 140, 40, 0);
PDF.Stroke;
PDF.ShowTextAligned(100, 200, 240, 240, taRight, vaBottom, 'Here is long text in the box.');

PDF.SaveToFile("test.pdf", true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->DrawRectangle(100, 100, 140, 40, 0);
PDF->Stroke();
PDF->ShowTextAligned(100, 100, 240, 140, taLeft, vaTop, "Here is long text in the box.");

PDF->DrawRectangle(100, 150, 140, 40, 0);
PDF->Stroke();
PDF->ShowTextAligned(100, 150, 240, 190, taCenter, vaCenter, "Here is long text in the box.");

PDF->DrawRectangle(100, 200, 140, 40, 0);
PDF->Stroke();
PDF->ShowTextAligned(100, 200, 240, 240, taRight, vaBottom, "Here is long text in the box.");

PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.DrawRectangle(100, 100, 140, 40, 0);
PDF.Stroke();
PDF.ShowTextAligned(100, 100, 240, 140, TextAlign.taLeft, VerticalAlign.vaTop, "Here is long text in the box.");

PDF.DrawRectangle(100, 150, 140, 40, 0);
PDF.Stroke();
PDF.ShowTextAligned(100, 150, 240, 190, TextAlign.taCenter, VerticalAlign.vaCenter, "Here is long text in the box.");

PDF.DrawRectangle(100, 200, 140, 40, 0);
PDF.Stroke();
PDF.ShowTextAligned(100, 200, 240, 240, TextAlign.taRight, VerticalAlign.vaBottom, "Here is long text in the box.");

PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.DrawRectangle 100, 100, 140, 40, 0
PDF.Stroke
PDF.ShowTextAligned 100, 100, 240, 140, 0, 0, "Here is long text in the box." 'TextAlign.taLeft VerticalAlign.vaTop

PDF.DrawRectangle 100, 150, 140, 40, 0
PDF.Stroke
PDF.ShowTextAligned 100, 150, 240, 190, 1, 1, "Here is long text in the box." 'TextAlign.taCenter VerticalAlign.vaCenter

PDF.DrawRectangle 100, 200, 140, 40, 0
PDF.Stroke
PDF.ShowTextAligned 100, 200, 240, 240, 2, 2, "Here is long text in the box." 'TextAlign.taRight VerticalAlign.vaBottom

PDF.SaveToFile "test.pdf", true

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2008, Two Pilots