添加文本水印

Phi*_*enn 2 coldfusion cfpdf coldfusion-8 cfimage

我已经学会了如何在pdf中添加水印.

<cfpdf action="addwatermark" image="NoteToSelf.png" 
    pages="1" 
    position="0,0" 
    showOnPrint="no"
    source="my.pdf" 
    destination="#myDir#\new.pdf" 
    overwrite="yes"
    opacity="10">
Run Code Online (Sandbox Code Playgroud)

我读它的方式,水印必须是一个图像.但NoteToSelf.png需要是我从数据库中读取的文本.

问:如何将文字添加为水印?

问:如果我需要使用图像作为水印,那么如何使用ImageNew标签创建文本图像?

Sam*_*mer 6

从ColdFusion 8.0.1开始,您可以直接向cfpdf标记提供文本:

<cfpdf action="addwatermark" position="10,10" text="I am the watermakr" source="pdfContent" rotation="90" foreground="yes">
Run Code Online (Sandbox Code Playgroud)

如果你没有在8.0.1上,那么你需要使用imageNew和图像写入文本函数并传入它.