Add a watermark, based on a user parameter value

You can configure IXIA CCMS Output Generator so that an output type includes a watermark based on the value of a user parameter.

The watermark is only included in the PDF output if a user enables it using a user parameter in the Generate Output dialog.

For more information about creating watermark images, refer to Watermark graphic creation.

To add a watermark, based on a user parameter value:

  1. You must first create and add the watermark image to the CCMS Output Generator.
    Note: The watermark image can have any name, and can be in any image format, other than SVG.
  2. Copy the watermark image to %OutputGenDir%/data/resources/client.
  3. Add the following lines to your preprocessors.xml file defined in %OutputGenDir%/conf/client:
    Note:

    You can name the parameter anything you like and use any label text you like. If there is already a <user> section in the preprocessor, add the parameter to the existing section.

    Acme company asked you to include a user selection for watermark inclusion. You must modify the appropriate preprocessor.
    <user>
    	<parameter label="Add watermark?" name="include.watermark" mandatory="false" type="choice">
    		<value name="no" _default="true">No</value>
    		<value name="yes">Yes</value>
    	</parameter>
    </user>

    In context:

    <preprocessor name="dita2pdf" class="com.ixiasoft.outputgenerator.preprocessor.AntProcessor" >
    	<parameters>
    		<system>
    			...
    		</system>
    		<user>
    			<parameter label="Add watermark?" name="include.watermark" mandatory="false" type="choice">
    				<value name="no" _default="true">No</value>
    				<value name="yes">Yes</value>
    			</parameter>
    		</user>
    	</parameters>
    </preprocessor>
  4. Save your changes to the preprocessor file.
  5. Add the following lines to the appropriate PDF targets in your conductor file.
    Important: If you are using a user parameter name other than "include.watermark", you must use the same name in the target.
    Suppose Acme company wants their users to be able to select the watermark you created on a need-to-include basis. Now you need to modify the appropriate target in your conductor file.
    <if>
    	<equals arg1="${outgen.job.userparam.include.watermark}" arg2="yes"/>
    	<then>
    		<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"/>
    	</then>
    </if>

    In context:

    <target name="Acme_PDF" depends="default_dependencies, flatten, resolve_container_keyref, extract_HiRes_images">
    	<echostart>Acme_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"/>-->
    
    	<if>
    		<equals arg1="${outgen.job.userparam.include.watermark}" arg2="yes"/>
    		<then>
    			<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"/>
    		</then>
    	</if>
    
    	<echoend>Acme_PDF</echoend>
    </target>
  6. Save your changes to the conductor file.
  7. Restart the Ixiasoft Output Generator service.

The watermark will be present in all PDFs created when the user selects the value that enables it on the Generate Output dialog.