You can specify a variable that contains an image as a watermark. The following example shows how to create a form from which the user can select an image:
<!--- The following code creates a form where you can choose an image to use as a watermark. ---> <h3>Choosing a Watermark</h3> <p>Please choose the image you would like to use as a watermark.</p> <!--- Create the ColdFusion form to select an image. ---> <table> <cfform action="addWatermark2.cfm" method="post" enctype="multipart/form-data"> <tr> <td><img src="../cfdocs/images/artgallery/maxwell01.jpg"/><br/> <cfinput type="radio" name="art" value="../cfdocs/images/artgallery/maxwell01.jpg" checked="yes"> Birch Forest</td> <td><img src="../cfdocs/images/artgallery/raquel05.jpg"/><br/> <cfinput type="radio" name="art" value="../cfdocs/images/artgallery/raquel05.jpg"> Lounging Woman</td> <td><img src="../cfdocs/images/artgallery/jeff01.jpg"/><br/> <cfinput type="radio" name="art" value="../cfdocs/images/artgallery/jeff01.jpg">Celebration</td> <td><img src="../cfdocs/images/artgallery/paul01.jpg"/><br/> <cfinput type="radio" name="art" value="../cfdocs/images/artgallery/paul01.jpg">Guitarist </td> </tr> </table> <br/> <cfinput type="Submit" name="submit" value="Submit"></p> </cfform>
The processing page uses the image selected from the form as the watermark for a PDF file:
<!--- ColdFusion applies the image selected from the form as the watermark in a PDF document by using the input variable form.art. ---> <cfpdf action="addwatermark" source="check.pdf" image="#form.art#" destination="output.pdf" foreground="yes" overwrite="true"> <p>The watermark has been added to your personalized checks.</p>