PDF Draw Modes

When using MBS Xojo DynaPDF Plugin, you can set the draw mode with the SetTextDrawMode function in DynaPDFMBS class.

Each mode has one of three flags set:

  • Whether to draw the outline of the glyphs.

  • Whether to fill the outline of the glyphs.

  • Whether to apply the outline as clipping path.

The text draw mode specifies how text should be rendered. Texts can be used as clipping paths such as normal vector graphics; however, the usage is not the same. To use a text as clipping path save the graphics state, set the text draw mode to a clipping mode, paint the objects which should be clipped into the path and restore the graphics state.

Normal

Default, render the text in the usual way. The fill color is used as the text’s color.

Stroke

Tread the glyph outlines as path to be stroked. The current line width and stroke color are used to paint the path.

FillStroke

Tread the glyph outlines as path to be stroked and filled. The current line width, fill color, and stroke color are used to paint the path.

Invisible

Neither fill nor stroke the text, the text is invisible.

FillClip

Tread the glyph outlines as path to be filled and add this path to the current clipping path. The settings of the current line width and fill color are used to paint the path.

We moved the drawn text a bit down right, so you csan see it.

StrokeClip

Tread the glyph outlines as path to be stroked and add this path to the current clipping path. The settings of the current line width and stroke color are used to paint the path.

FillStrokeClip

Tread the glyph outlines as path to be stroked and filled and add this path to the current clipping path. The settings of the current line width, fill color and stroke color are used to paint the path.

Clipping

Tread the glyph outlines as path and add this path to the current clipping path. No text is drawn.

If you try it, the script may be as easy as this:

**Call** pdf.SetFont "Helvetica", pdf.kfsBold, 80, **True**
**Call** pdf.SetStrokeColor(pdf.kPDF_BLUE)
**Call** pdf.SetFillColor(pdf.kPDF_RED) 
**Call** pdf.SetTextDrawMode pdf.kfmStroke
**Call** pdf.WriteText( 20, 100, "Hello World")

Please try and let us know if you have questions.