JavaScript Editor Javascript debugger     Website design 


Create spot color (PECL ps:1.1.0-1.3.5)
int ps_makespotcolor ( resource psdoc, string name [, float reserved] )

Creates a spot color from the current fill color. The fill color must be defined in rgb, cmyk or gray colorspace. The spot color name can be an arbitrary name. A spot color can be set as any color with ps_setcolor(). When the document is not printed but displayed by an postscript viewer the given color in the specified color space is use.



Resource identifier of the postscript file as returned by ps_new().


Name of the spot color, e.g. Pantone 5565.

Return Values

The id of the new spot color or 0 in case of an error.


Example 2020. Creating and using a spot color

= ps_new();
if (!
ps_open_file($ps, "")) {
"Cannot open PostScript file\n";

ps_set_info($ps, "Creator", "spotcolor.php");
ps_set_info($ps, "Author", "Uwe Steinmann");
ps_set_info($ps, "Title", "Spot color example");

ps_begin_page($ps, 596, 842);
ps_setcolor($ps, "fill", "cmyk", 0.37, 0.0, 0.34, 0.34);
$spotcolor = ps_makespotcolor($ps, "PANTONE 5565 C", 0);
ps_setcolor($ps, "fill", "spot", $spotcolor, 0.5, 0.0, 0.0);
ps_moveto($ps, 100, 100);
ps_lineto($ps, 100, 200);
ps_lineto($ps, 200, 200);
ps_lineto($ps, 200, 100);
ps_lineto($ps, 100, 100);


This example creates the spot color "PANTONE 5565 C" which is a darker green (olive) and fills a rectangle with 50% intensity.