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.



Changes the default font.


pdf(set_font, hash( [ name,          font_name, ]
                    [ size,          font_size, ]
                    [ colorCMYK,     cmyk_color,]
                    [ colorRGB,      rgb_color, ]
                    [ justification, text_justification ] ) )


name string The font type (name). No.
size integer The size of the font. No.
colorCMYK array The CMYK color. No.
colorRGB array The RGB color. No.
justification string The text alignment. No.


This function makes it possible to change the default/current font and the text color, style, etc. The following list shows the fonts that can be used.

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

Either the "colorRGB" or the "colorCMYK" parameter can be used to specify the font color. The "colorRGB" parameter must be an array consisting of three integers between 0 and 255. The "colorCMYK" parameter must be an array of four decimal values between 0 and 1.

The justification parameter controls the text alignment, it can be:

  • left
  • right
  • center
  • full


Example 1

{pdf( 'set_font', hash( 'name', 'Times-Roman', 'size', 12 ) )}
{pdf( 'text', 'Hello world'|wash( 'pdf' ) )}
{pdf( 'new_line' )}
{pdf( 'new_line' )}
{pdf( 'set_font', hash( 'name', 'Times-Italic',
                        'size', 10,
                        'justification', 'full',
                        'colorRGB', array( 255, 255, 128 ) ) )}
{pdf( 'text', 'Example'|wash( 'pdf' ) )}

This example demonstrates how to change the default font type, size, style, and color.

Balazs Halasy (13/05/2004 3:15 pm)

Balazs Halasy (04/05/2005 11:43 am)


There are no comments.