View sample product: Sample Product Here
Command: pattern
Syntax:
[type,c1,c2,c3,c4,optlist]
Reference: PDF Lib API document
type is either axial or radial
c1, c2, c3, c4
Color values of the shading’s end color, interpreted in the color space of the shading’s start color. If the current fill color space is a spot color space c1 is ignored, and c2 contains the tint value. The parameters c1, c2, c3, and c4 are ignored if the endcolor or stopcolors option is supplied.
optlist Option list describing aspects of the shading. The following options can be used:
antialias, boundingbox, end, endcolor, extend0, extend1, N, r0, r1, startcolor, stopcolors, type
See table below for more information on the each parameter.
Examples
- Using stopcolors where more than two colors can be set to create a gradient.
Two colors one at 0% and the other at 100% of the block.
[axial,0,0,0,0,stopcolors={0% {cmyk 1 0 0 0} 100% {cmyk 0 1 0 0}}]
Three colors used here. At 0%, 40% and 100%.
CYAN BLACK MAGENTA
[axial,0,0,0,0,stopcolors={0% {cmyk 1 0 0 0} 40% {cmyk 0 0 0 1} 100% {cmyk 0 1 0 0}}]
- Using no optlist
Make sure that the block fill color is set to the start color, for example:
{cmyk 1 0 0 0} – Cyan.
Pattern: [axial,0,1,0,0] è Magenta
There is no need to fill the 4 values with other than 0 if ‘stop colors’ or ‘start and end colors’ are used.
- Using start and end colours
[axial,0,0,0,0,startcolor={cmyk 1 0 0 0} endcolor={cmyk 0 1 1 0}]
Or use names colors
[axial,0,0,0,0,startcolor=red endcolor=blue]
Note:
You can use shrink parameter in the status command so that the 100% (or endcolor) will always be at the end of the text.
Options for PDF_shading( ) and suboptions for the shading graphics appearance option
option | description |
antialias | (Boolean) Specifies whether to activate antialiasing for the shading. Default: false |
boundingbox | (Rectangle) A rectangle defining the shading’s bounding box in user coordinates. The bounding box will be applied as a temporary clipping path when the shading is painted (in addition to the current clippingpath which may be in effect). This option may be useful to clip the shading without applying PDF_clip( ). Default for PDF_shading( ): no clipping Default for the shading graphics appearance option: the matchbox or table cell rectangle |
end | (List of 2 floats or percentages; not for PDF_shading( )) Coordinates of the ending point (for type=axial)or a point on the ending circle (for type=radial), specified as percentages of the rectangle’s width and height or in user coordinates. Default: {100% 100%} |
endcolor | (Color; ignored if stopcolors is supplied; one of the options endcolor and stopcolors is required for the shading graphics appearance option) The shading’s end color. Default for PDF_shading( ): the last color provided in the stopcolors option if specified, otherwise the values supplied in the parameters c1, c2, c3, and c4 |
extend0 | (Boolean) Specifies whether to extend the shading beyond the starting point or circle. Default: false |
extend1 | (Boolean) Specifies whether to extend the shading beyond the ending point or circle. Default: false |
N | (Positive Float) Exponent for the color transition method. Default: 1 |
r0 | (Float; only for type=radial) Radius of the starting circle in user coordinates. Default: 0 |
r1 | (Float; only for type=radial) Radius of the ending circle in user coordinates. Default for PDF_shading( ): 0. Default for the shading graphics appearance option: distance between start and end |
start | (List of 2 floats or percentages; not for PDF_shading( )) Coordinates of the starting point (type=axial) or the center of the starting circle (type=radial), specified as percentages of the rectangle’s width and height or in user coordinates. Default: {0% 0%} |
startcolor | (Color; ignored if stopcolors is supplied) The shading’s start color. Default: the first color provided in the stopcolors option if specified, otherwise the color specified in the option fillcolor for the matchbox or table cell |
stopcolors | (List of pairs; one of the options endcolor and stopcolors is required for the shading graphics appearance option) List of two or more colors for the shading. Each pair contains a float value or a percentage for the position of an intermediate shading color in the inclusive interval 0...1 and the corresponding color value. All color values must use the same color space except for spot colors with Lab alternate colors as described in the Details section above. The positions must be sorted in ascending order, but adjacent position values may be identical. If no value for position 0 is present the first list entry is used; if no value for position 1 is present the last list entry is used. If this option is supplied the options startcolor and endcolor, the parameters c1,...,c4 and the current fill color are ignored. Examples: stopcolors={0 red 0.4 magenta 0.75 green 1 black} stopcolors={0% {cmyk 1 0 0 0} 33% {cmyk 0 0.4 0.3 0}} 100% {cmyk 0 0 0.2 0.8}} stopcolors={0% {spotname {PANTONE 123 U} 1} 100% {spotname {PANTONE 289 U} 1} } |
type | (Keyword) Shading type: axial for a linear shading or radial for a circle-like shading. Default: value of the parameter type if present (only for PDF_shading( )), otherwise: axial |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article