Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PDFs - Watermarking & Locking Content

New Here ,
Aug 16, 2011 Aug 16, 2011

Running:

  • Windows Server 2003 R2
  • Coldfusion 9 (Developer Edition currently)
  • IIS v6.0
  • MySQL

I have 2 questions regarding PDFs.

1) Will the watermarking not work in developer edition because of the Adobe watermark that is already there or am I doing it wrong?

<cfpdf action="addwatermark" source="reports/#FileName#" image="text.tiff"

    destination="c:\Inetpub\wwwroot\admin\reports\#FileName#" overwrite="yes">

2) Is there any way to lock down a PDF file? I'm writing tables of text and I want to make it so users can't select the text, is this possible?

2.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Aug 17, 2011 Aug 17, 2011

The Coldfusion Developer Edition watermark is a large

white rectangle

Oh yeah, I forgot about the big white rectangle issues Any difference if you use foreground=true?

Translate
Valorous Hero ,
Aug 16, 2011 Aug 16, 2011

source="reports/#FileName#" image="text.tiff"

No, it works even under the developer edition. Perhaps one of your paths is off?=. Have you tried using absolute file paths?

2) Is there any way to lock down a PDF file? I'm writing

tables of text and I want to make it so users can't select

the text, is this possible?

Cfpdf allows you to disable certain features like copying by using action="protect". See the "permissions" section of the documentation for a complete listing. Just keep in mind these settings are not bullet proof. A determined user can find a way around such restrictions.

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7995.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2011 Aug 17, 2011

Thanks for the help, the link you provided answered all the questions I had concerning PDF protections.

I am still having problems with the watermarking. I used absolute pathing and still no dice. Here's the code I'm using, that I took a snippet of from a tutorial I can't find at the moment.

<cffile action="write" output="#HOLPDF#" file="c:\Inetpub\wwwroot\admin\reports\#FileName#">

<!--- Create a blank image that is 500 pixels square. --->

<cfset myImage=ImageNew("",500,500)>

<!--- Set the background color for the image to white. --->

<cfset ImageSetBackgroundColor(myImage,"white")>

<!---Clear the rectangle specified on myImage and apply the background color. --->

<cfset ImageClearRect(myImage,0,0,500,500)>

<!--- Turn on antialiasing. --->

<cfset ImageSetAntialiasing(myImage)>

<!--- Draw the text. --->

<cfset attr=StructNew()>

<cfset attr.size=50>

<cfset attr.style="bold">

<cfset attr.font="Verdana">

<cfset ImageSetDrawingColor(myImage,"blue")>

<cfset ImageDrawText(myImage,"IPSUMDIPSUM",100,250,attr)>

<!--- Write the text image to a file. --->

<cfimage action="write" source="#myImage#" destination="text.tiff" overwrite ="yes">

<!--- Use the text image as a watermark in the PDF document. --->

<cfpdf action="addwatermark" source="c:\Inetpub\wwwroot\admin\reports\#FileName#" image="c:\Inetpub\wwwroot\admin\text.tiff"

    destination="c:\Inetpub\wwwroot\admin\reports\#FileName#" overwrite="yes">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2011 Aug 17, 2011

You were right, the watermarking does work. I tried it with a gigantic image and it only shows around the edges of the page. The Coldfusion Developer Edition watermark is a large white rectangle that takes almost all the page, and adding a watermark places it under the existing watermark.

EDIT:

Using foreground="yes" lets you show the watermark on top of the Adobe watermark.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 17, 2011 Aug 17, 2011

The Coldfusion Developer Edition watermark is a large

white rectangle

Oh yeah, I forgot about the big white rectangle issues Any difference if you use foreground=true?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 17, 2011 Aug 17, 2011
LATEST
EDIT:

Using foreground="yes" lets you show the watermark on top of the Adobe watermark.

Oh, duh! I see you figured it out. Unfortunately edits are only visible via the web interface and I usually respond via email instead.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources