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.



Creates a filled rectangle.


pdf( filled_rectangle, hash( x,          x_position,
                             y,          y_position,
                             width,      width,
                             height,     height,
                           [ rgb,        rgb_color,         ]
                           [ rgbTop,     rgb_top_color,
                             rgbBottom,  rgb_bottom_color,  ]
                           [ cmyk,       cmyk_color,        ]
                           [ cmykTop,    cmyk_top_color, 
                             cmykBottom, cmyk_bottom_color, ] ) )


x integer/float X coordinate. Yes.
y integer/float Y coordinate. Yes.
width integer/float Rectangle width. Yes.
height integer/float Rectangle height. Yes.
rgb array Rectangle RGB color. No.
rgbTop array Rectangle top RGB color. No.
rgbBottom array Rectangle bottom RGB color. No.
cmyk array Rectangle CMYK color. No.
cmykTop array Rectangle top CMYK color. No.
cmykBottom array Rectangle bottom CMYK color. No.


This function creates a filled rectangle. The "x" and "y" parameters specify the lower-left corner of the rectangle. The "width" and "height" parameters determine the size of the rectangle.

The color of the rectangle can be specified using either the "rgb" or the "cmyk" parameter. The "rgb" parameter must be an array consisting of three numbers between 0 and 255. The "cmyk" parameter must be an array of four floats between 0 and 1. The "rgb" or "cmyk" parameter fills the entire rectangle with the same color; no color interpolation. This option has the same result as setting the "rgbTop", "rgbBottom" or "cmykTop", "cmykBottom" with the same color. A different top and bottom color results in a gradient fill. The color will be linearly interpolated from the top color to the bottom color of the rectangle.

This function uses features that appeared in the PDF1.3 specification. Because of this, rectangles will not visible in PDF-viewers that are not PDF 1.3 compliant (for example "Ghostview", etc.).


Example 1

{pdf( 'filled_rectangle', hash( 'x',          -10,
                                'y',          30.5,
                                'width',      282.9,
                                'height,      821.9,
                                'cmykTop,     array( 0.96, 0.30, 0, 0 ),
                                'cmykBottom', array( 0.15, 0.04, 0, 0 ) ) )}
{pdf( 'filled_rectangle', hash( 'x',          272.9,
                                'y',          30.5,
                                'width',      333,
                                'height',     821.9,
                                'cmykTop',    array( 0.34, 0.05, 0, 0 ),
                                'cmykBottom', array( 0.10, 0.02, 0, 0 ) ) ) }
{pdf( 'filled_rectangle', hash( 'x',      -10,
                                'y',      -10,
                                'width',  606,
                                'height', 40.5,
                                'cmyk',   array( 0.89, 0.43, 0.01, 0 ) ) )}

This example fills the page with three different rectangles.

Balazs Halasy (14/05/2004 12:11 pm)

Balazs Halasy (04/05/2005 1:11 pm)


There are no comments.