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.
Add a comment
|
1 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.
<style>
.watermark {
background-repeat: repeat;
background-image: url("{!URLFOR($Resource.WatermarkImage)}");
}
</style>
<body class="watermark">
<!-- some more stuff in here -->
</body>
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 :
-
1Hi Mitch, in the future, you can use the code button (
{}
or Ctrl-K) to format your code in a gray code block with syntax highlights and proper spacing. I've went ahead and updated this answer for you.– sfdcfox ♦Commented Nov 27, 2017 at 19:14