This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Creating a watermark

nickweavers wrote on 2011-09-02:
Can any one tell me the best way to generate a watermark on all of the PDF pages I create? I didn't see an API function that looked like it would do it? I was hoping I could just supply an API call with the URI or src of an image file containing the text for the watermark and maybe some parms (eg level of transparency, angle through which text is rotated from horizontal etc).
support wrote on 2011-09-04:
Hi, we do not support watermarks at the moment.
gbweb wrote on 2012-01-27:
Is there an update to this? We need this for a client.
support wrote on 2012-01-29:
Hi, we plan to implement this but it is not available yet.
nickweavers wrote on 2012-02-05:
Not sure if it's helpful to anyone, but I came up with this amateur hack to add my watermark. It's just a text overlay but it uses gstate to make the text partially transparent and rotates it to appear diagonally (stamp=ll2ur) across the page. It worked for me but YMMV.

       /* Create an extended graphics state with transparency set to 50%, using
         * create_gstate() with the "opacityfill" option set to 0.5.
         */
        $gstate = $p->create_gstate("opacityfill=0.1");
        /* Apply the extended graphics state */
        $p->set_gstate($gstate);
        /* Use an optlist with stamp=ll2ur to place the watermark "stamp" from lower left to upper right. */
        $optlist = "stamp=ll2ur font=" . $font . " fontsize=8 boxsize={" . $box_x . " " . $box_y . "} textrendering=0";
        $p->fit_textline('Copyright ACA 2011',$llx, $lly+170, $optlist);

        /* Restore the current graphics state */
        $p->restore();


Nick
support wrote on 2012-02-09:
We just added support for watermarks. More info in the docs.