SetTextRenderingMode
IPDFDocument4 :: Page Operations :: Text

See Also Example
Collapse All

This method sets the text rendering mode.

Mode

Example

Description

trFillText

Fill text

trStrokeText

Stroke text

trFillAndStroke

Fill, then stroke text

trNeitherFillNorStoke

Neither fill nor stroke text (invisible)

trFillTextAndAddPathForClipping

Fill text and add to path for clipping

trStrokeTextAndAddPathForClipping

Stroke text and add to path for clipping

trFillStrokeAndAddPathForClipping

Fill, then stroke text and add to path for clipping

trAddTextToPathForClipping

Add text to path for clipping

Syntax

HRESULT SetTextRenderingMode (
TextRenderingMode mode
)
Parameters
mode
New text rendering mode.

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

Remarks

This procedure sets the mode that determines how the character outline is used. By default, the character outline is used for filling operations in which the inside of the outline path is painted with the current fill color in a solid pattern. This state may be changed by calling this method.

Example

Setting the Text Rendering Mode

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.SetColorFill(0, 0.4, 0.2, 0);
PDF.SetColorStroke(1, 0, 0, 0);
fnt := PDF.AddFont('Times', false, false, false, false, FontCharset.fcDefault);
PDF.UseFont(fnt, 36);

PDF.SetTextRenderingMode(trFillText);
PDF.ShowTextAt(20, 20, 'ABCdef');

PDF.SetTextRenderingMode(trmStrokeText);
PDF.ShowTextAt 20, 70, 'ABCdef');

PDF.SetTextRenderingMode(trmFillAndStroke);
PDF.ShowTextAt(20, 120, 'ABCdef');

PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->SetColorFill(0f, 0.4f, 0.2f, 0f);
PDF->SetColorStroke(1f, 0f, 0f, 0f);
long fnt = PDF->AddFont("Times", false, false, false, false, FontCharset.fcDefault);
PDF->UseFont(fnt, 36);

PDF->SetTextRenderingMode(trFillText);
PDF->ShowTextAt(20, 20, "ABCdef");

PDF->SetTextRenderingMode(trmStrokeText);
PDF->ShowTextAt 20, 70, "ABCdef");

PDF->SetTextRenderingMode(trmFillAndStroke);
PDF->ShowTextAt(20, 120, "ABCdef");

PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.SetColorFill(0f, 0.4f, 0.2f, 0f);
PDF.SetColorStroke(1f, 0f, 0f, 0f);
long fnt = PDF.AddFont("Times", false, false, false, false, FontCharset.fcDefault);
PDF.UseFont(fnt, 36);

PDF.SetTextRenderingMode(TextRenderingMode.trFillText);
PDF.ShowTextAt(20, 20, "ABCdef");

PDF.SetTextRenderingMode(TextRenderingMode.trmStrokeText);
PDF.ShowTextAt 20, 70, "ABCdef");

PDF.SetTextRenderingMode(TextRenderingMode.trmFillAndStroke);
PDF.ShowTextAt(20, 120, "ABCdef");

PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.SetColorFill 0, 0.4, 0.2, 0
PDF.SetColorStroke 1, 0, 0, 0
fnt = PDF.AddFont("Times", false, false, false, false, 0)'FontCharset.fcDefault
PDF.UseFont fnt, 36

PDF.SetTextRenderingMode 0 'TextRenderingMode.trFillText
PDF.ShowTextAt 20, 20, "ABCdef"

PDF.SetTextRenderingMode 1 'trmStrokeText
PDF.ShowTextAt 20, 70, "ABCdef"

PDF.SetTextRenderingMode 2 'trmFillAndStroke
PDF.ShowTextAt 20, 120, "ABCdef"

PDF.SaveToFile "test.pdf", true

See Also

Reference