Skip to main content
Participant
August 15, 2008
Question

coldfusion 8,cfdocument, cfpdf, watermark, blank page output?

  • August 15, 2008
  • 2 replies
  • 1734 views
I'm using cfdocument. No matter whether I use PDF or Flashpaper as the type, if I specify the "name" attribute it results in an outputted page that is blank. If I remove the name attribute, it renders the pdf or flashpaper page.

Why is this happening? I want to use it to create a PDF onscreen and then add a watermark to the just generated PDF, but the cfpdf action="addWatermark" requires you to specify the name of the pdf to add the watermark to. Since I cannot set the name, I can't add the watermark.

What can I do? Thanks.
This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
August 16, 2008
....if I specify the "name" attribute it results in an outputted page that is blank. If I remove the name attribute, it renders the pdf or flashpaper page.

Why is this happening?


It is so by design in the cfdocument as well as in the cfpdf tag. If you specify a name attribute, Coldfusion wont display the PDF or Flashpaper output, but will hold it in memory as a variable.

To do the watermark with cfpdf action="addWatermark" you must specify the source attribute. That implies that, in the cfdocument that goes before, you should save the PDF as a file.

Here is an example. Coldfusion will create myTestDoc.pdf and store it in the current directory. For the watermark, I wish to use an image stored in the same directory. Coldfusion will then store the watermarked result as the file myWatermarkedDoc.pdf. The browser will only display the text PDF doc watermarked and saved as file.


edited: read "watermark" in place of "bookmark"



Inspiring
August 16, 2008
If I'm not mistaken name is an optional attribute. The attribute to the the PDF file is source="path to document".