Add a watermark to PDFs

You can configure CCMS Output Generator so that an output type always includes a watermark.

You must first add the watermark image to the CCMS Output Generator. Then you can set up the task in the appropriate targets in your conductor file.

For more information about creating watermark images, refer to Creating watermark images.

  1. Copy the watermark image to %OutputGenDir%/data/resources/client.

    The watermark image can have any name (the examples below uses draft-watermark.png), and it can be any image format except SVG.)

  2. Add the following lines to the appropriate PDF targets in your conductor file:
    <move file="${outgen.job.output.dir}/${outgen.job.source.name.noext}.pdf" todir="${outgen.job.dir}"/>
    <watermark execute="true" 
    		   inputfile="${outgen.job.dir}/${outgen.job.source.name.noext}.pdf"
    		   tempfile="${outgen.job.output.dir}/${outgen.job.source.name.noext}.pdf"
    		   imagefile="${outgen.resources.dir.client}/draft-watermark.png"/>

    Here are those lines in context:

    <target name="BigCorp_PDF" depends="default_dependencies, flatten, resolve_container_keyref, extract_HiRes_images">
    	<echostart>BigCorp_PDF</echostart>
    
    	<!-- These are the required target calls to do -->
    	<ot_build_add_ditaval_ifpresent/>
    	<ot_build_clean_ot_temp/>
    
    	...
    
    	<!-- Set the property job.keep.temp to preserve the completed temp folder of the task -->
    	<!--<property name="job.keep.temp" value="yes"/>-->
    
    	<move file="${outgen.job.output.dir}/${outgen.job.source.name.noext}.pdf" todir="${outgen.job.dir}"/>
    	<watermark execute="true" 
    				   inputfile="${outgen.job.dir}/${outgen.job.source.name.noext}.pdf"
    				   tempfile="${outgen.job.output.dir}/${outgen.job.source.name.noext}.pdf"
    				   imagefile="${outgen.resources.dir.client}/draft-watermark.png"/>
    
    	<echoend>BigCorp_PDF</echoend>
    </target>
  3. Save your changes to the conductor file.

You do not need to restart CCMS Output Generator. The watermark will be present in all PDFs created using the output type that corresponds to the target you edited.