<HTML ><HEAD ><TITLE >pdf_setcolor</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="PDF functions " HREF="ref.pdf.html"><LINK REL="PREVIOUS" TITLE="pdf_set_word_spacing" HREF="function.pdf-set-word-spacing.html"><LINK REL="NEXT" TITLE="pdf_setdash" HREF="function.pdf-setdash.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pdf-set-word-spacing.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pdf-setdash.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.pdf-setcolor" ></A >pdf_setcolor</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN72364" ></A ><P > (PHP 4 >= 4.0.5)</P >pdf_setcolor -- Sets fill and stroke color</DIV ><DIV CLASS="refsect1" ><A NAME="AEN72367" ></A ><H2 >Description</H2 >void <B CLASS="methodname" >pdf_setcolor</B > ( int pdf object, string type, string colorspace, float c1 [, float c2 [, float c3 [, float c4]]])<BR ></BR ><P > Set the current color space and color. The parameter <TT CLASS="parameter" ><I >type</I ></TT > can be "fill", "stroke", or "both" to specify that the color is set for filling, stroking or both filling and stroking. The parameter <TT CLASS="parameter" ><I >colorspace</I ></TT > can be <TT CLASS="literal" >gray</TT >, <TT CLASS="literal" >rgb</TT >, <TT CLASS="literal" >cmyk</TT >, <TT CLASS="literal" >spot</TT > or <TT CLASS="literal" >pattern</TT >. The parameters <TT CLASS="parameter" ><I >c1</I ></TT >, <TT CLASS="parameter" ><I >c2</I ></TT >, <TT CLASS="parameter" ><I >c3</I ></TT > and <TT CLASS="parameter" ><I >c4</I ></TT > represent the color components for the color space specified by <TT CLASS="parameter" ><I >colorspace</I ></TT >. Except as otherwise noted, the color components are floating-point values that range from 0 to 1. </P ><P > For <TT CLASS="literal" >gray</TT > only <TT CLASS="parameter" ><I >c1</I ></TT > is used. </P ><P > For <TT CLASS="literal" >rgb</TT > parameters <TT CLASS="parameter" ><I >c1</I ></TT >, <TT CLASS="parameter" ><I >c2</I ></TT >, and <TT CLASS="parameter" ><I >c3</I ></TT > specify the red, green and blue values respectively. <DIV CLASS="informalexample" ><A NAME="AEN72414" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >// Set fill and stroke colors to white. pdf_setcolor($pdf, "both", "rgb", 1, 1, 1);</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > For <TT CLASS="literal" >cmyk</TT >, parameters <TT CLASS="parameter" ><I >c1</I ></TT >, <TT CLASS="parameter" ><I >c2</I ></TT >, <TT CLASS="parameter" ><I >c3</I ></TT >, and <TT CLASS="parameter" ><I >c4</I ></TT > are the cyan, magenta, yellow and black values, respectively. <DIV CLASS="informalexample" ><A NAME="AEN72422" ></A ><P ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" >// Set fill and stroke colors to white. pdf_setcolor($pdf, "both", "cmyk", 0, 0, 0, 1);</PRE ></TD ></TR ></TABLE ><P ></P ></DIV > </P ><P > For <TT CLASS="literal" >spot</TT >, <TT CLASS="parameter" ><I >c1</I ></TT > should be a spot color handles returned by <A HREF="function.pdf-makespotcolor.html" ><B CLASS="function" >pdf_makespotcolor()</B ></A > and <TT CLASS="parameter" ><I >c2</I ></TT > is a tint value between 0 and 1. </P ><P > For <TT CLASS="literal" >pattern</TT >, <TT CLASS="parameter" ><I >c1</I ></TT > should be a pattern handle returned by <A HREF="function.pdf-begin-pattern.html" ><B CLASS="function" >pdf_begin_pattern()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pdf-set-word-spacing.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pdf-setdash.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >pdf_set_word_spacing</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.pdf.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >pdf_setdash</TD ></TR ></TABLE ></DIV ></BODY ></HTML >