text

Summary

This function inserts formatted text into the PDF document.

Usage

pdf( text, page_text, hash( [ font,  font_name,     ]
                            [ size,  font_size,     ]
                            [ rgb,   rgb_color,     ]
                            [ cmyk,  cmyk_color,    ]
                            [ align, text_alignment ] ) )

Parameters

NameTypeDescriptionRequired
text string The text that should be inserted. Yes.
font string The font type. No.
size integer The size of the font. No.
rgb array The RGB text color. No.
cmyk array The CMYK text color. No.
align text The text alignment. No.

Description

This function inserts regular text into the PDF document. The font type, font size, font color, and text alignment can be specified. If not specified, this function uses the current settings. The available font types are:

The "rgb" and "cmyk" parameters can be used to specify the font color. Only one of these two parameters can be used at the same time. The "rgb" parameter must be an array of three integers between 0 and 255. The "cmyk" parameter must be an array of four decimal values between 0.0 and 1.0.

The alignment parameter can be used to set the text alignment, possible values are:

The last options will spread/justify the text from the left to the right margin if it covers at least 80% of the margin-width.

Examples

Example 1

{pdf( 'text', 'eZ Publish and PDF'|wash( 'pdf' ),
       hash( 'font', 'Times-Bold', 'size', 22, 'align', 'center' ) )}

This example generates a centered text using "Times-Bold" at 22 points.

Example 2

{pdf( 'text', 'red'|wash( 'pdf' ), hash( 'rgb', array( 255, 0, 0 ) ) )}
{pdf( 'text', 'green'|wash( 'pdf' ), hash( 'rgb', array( 0, 255, 0 ) ) )}
{pdf( 'text', 'blue'|wash( 'pdf' ), hash( 'rgb', array( 0, 0, 255 ) ) )}

This example demonstrates text coloring.

Example 3

{pdf( 'text', 'A primary color is a color that can not be created by mixing other colors in the gamut of a given color space. Primary colors may themselves be mixed to produce most of the colors in a given color space.'|wash( 'pdf' ), hash( 'align', 'full' ) )}

This example demonstrates how the text can be justified.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.