PDFPAGE_TextOutBox2
IPDFDocument3 :: PDF page methods

See Also Example
Collapse All

This method draws wrapped text bounded by a rectangle. It also allows the text to be justified.

Syntax

LONG PDFPAGE_TextOutBox2 (
DOUBLE x,
DOUBLE y,
DOUBLE boxWidth,
DOUBLE boxHeight,
TxHorJust horizontalJustification,
TxVertJust verticalJustification,
BSTR contents
)
Parameters
x
X coordinate of the top-lef corner of the bounding rectangle

y
Y coordinate of the top-lef corner of the bounding rectangle

boxWidth
Width of the bounding rectangle

boxHeight
Height of the bounding rectangle

horizontalJustification
Horizontal justification

verticalJustification
Vertical justification

contents
Text to be displayed

Return value
The number of characters that were successfully drawn in the "box".

Remarks

This method draws a text line inside the bounding rectangle with left-top corner at (left, top), box size of (boxWidth, boxHeight), and with the horizontal and vertical justifications specified.

Equivalent in new interface: IPDFDocument4::ShowTextLines.

Example

Drawing Wrapped and Justified Text in a Box

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.PDFPAGE_SetActiveFont('Helvetica', false, false, false, false, 12.0, 0);

PDF.PDFPAGE_Rectangle(100, 100, 240, 140);
PDF.PDFPAGE_Stroke;
long cnt = PDF.PDFPAGE_TextOutBox2(100, 100, 140, 40, 0, 0,'Here is long text in the box.');

PDF.PDFPAGE_Rectangle(100, 150, 240, 190);
PDF.PDFPAGE_Stroke;
cnt = PDF.PDFPAGE_TextOutBox2(100, 150, 140, 40, 1, 1, 'Here is long text in the box.');

PDF.PDFPAGE_Rectangle(100, 200, 240, 240);
PDF.PDFPAGE_Stroke;
cnt = PDF.PDFPAGE_TextOutBox2(100, 200, 140, 40, 2, 2, 'Here is long text in the box.');

PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->PDFPAGE_SetActiveFont("Helvetica", FALSE, FALSE, FALSE, FALSE, 12.0, 0);

PDF->PDFPAGE_Rectangle(100, 100, 240, 140);
PDF->PDFPAGE_Stroke();
LONG cnt = PDF->PDFPAGE_TextOutBox2(100, 100, 140, 40, 0, 0, "Here is long text in the box.");

PDF->PDFPAGE_Rectangle(100, 150, 240, 190);
PDF->PDFPAGE_Stroke();
cnt = PDF->PDFPAGE_TextOutBox2(100, 150, 140, 40, 1, 1, "Here is long text in the box.");

PDF->PDFPAGE_Rectangle(100, 200, 240, 240);
PDF->PDFPAGE_Stroke();
cnt = PDF->PDFPAGE_TextOutBox2(100, 200, 140, 40, 2, 2, "Here is long text in the box.");

PDF->EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.PDFPAGE_SetActiveFont("Helvetica", false, false, false, false, 12.0, 0);

PDF.PDFPAGE_Rectangle(100, 100, 240, 140);
PDF.PDFPAGE_Stroke();
long cnt = PDF.PDFPAGE_TextOutBox2(100, 100, 140, 40, 0, 0, "Here is long text in the box.");

PDF.PDFPAGE_Rectangle(100, 150, 240, 190);
PDF.PDFPAGE_Stroke();
cnt = PDF.PDFPAGE_TextOutBox2(100, 150, 140, 40, 1, 1, "Here is long text in the box.");

PDF.PDFPAGE_Rectangle(100, 200, 240, 240);
PDF.PDFPAGE_Stroke();
cnt = PDF.PDFPAGE_TextOutBox2(100, 200, 140, 40, 2, 2, "Here is long text in the box.");

PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.PDFPAGE_SetActiveFont "Helvetica", False, False, False, False, 12.0, 0

PDF.PDFPAGE_Rectangle 100, 100, 240, 140
PDF.PDFPAGE_Stroke
cnt = PDF.PDFPAGE_TextOutBox2(100, 100, 140, 40, 0, 0, "Here is long text in the box.")

PDF.PDFPAGE_Rectangle 100, 150, 240, 190
PDF.PDFPAGE_Stroke
cnt = PDF.PDFPAGE_TextOutBox2(100, 150, 140, 40, 1, 1, "Here is long text in the box.")

PDF.PDFPAGE_Rectangle 100, 200, 240, 240
PDF.PDFPAGE_Stroke
cnt = PDF.PDFPAGE_TextOutBox2(100, 200, 140, 40, 2, 2, "Here is long text in the box.")

PDF.EndDoc

See Also

Reference