Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

text

Summary

This function inserts formatted text into the PDF document (DEPRECATED).

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:

  • Courier-Bold
  • Courier-BoldOblique
  • Courier-Oblique
  • Courier
  • Helvetica-Bold
  • Helvetica-BoldOblique
  • Helvetica-Obliqu
  • Helvetic
  • Symbol
  • Times-Bold
  • Times-BoldItalic
  • Times-Italic
  • Times-Roman

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:

  • left
  • right
  • center
  • full

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.

Balazs Halasy (14/05/2004 8:06 am)

Julia Shymova (11/01/2008 1:11 pm)

Balazs Halasy, Julia Shymova


Comments

There are no comments.