[SalesForce] Add watermark to PDF document

Is there any way to add watermark to certain PDF files stored in document folder?

We would like to do a dynamic watermarking capability to the documents with confidential information of user who download the document. Is there a way to accomplish this or do we need to use a third party tool to make it happen?

In our case we have a VF page that displays the document assigned to them and they document the files from there.

Best Answer

Yes you can do this when you render a visualforce page as a pdf.

Just create a static resource that has your watermark image, and add the following lines to your Visualforce Page.


.watermark {
                background-repeat: repeat;
                background-image: url("{!URLFOR($Resource.WatermarkImage)}");


<body class="watermark">

<!-- some more stuff in here  -->


This will work when you render a visualforce page as a pdf.

You may need to wrap your document PDF to be displayed in a page like the one described above. If that's the case, you should check out this solution to render PDF in visualforce :

How to render PDF documents in visualforce page

Related Topic