Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ColdFusion8:Acrobat:images/watermarks 1

Status
Not open for further replies.

EdGioja

Programmer
Nov 6, 2003
39
0
0
US
I've looked everywhere and can not find an answer to this. I'm hoping that the vast brain trust in this "room" can help me.

Here is what I am doing...

I want to attach a .jpg of a signature to a form. Every form is different as to where that location is BUT I have a form field (fSignature) where that signature needs to go.

In Acrobat, using javascript, I am able to determine the location of that text field and place the watermark there OR use a button and replace the icon with the .jpg.

I really want to do this from ColdFusion, though. With CF8, I can do a <cfpdf action="getinfo"> and a <cfpdfform action="read"> to get information, but none of it tells me WHERE the fields are. Nor can I find a CF8 function that allows me to either put a .jpg in a text field (understandably) or change the icon of a form button.

So, in summary, my questions are:

Does anyone know how to change the icon of a PDF Form button?

AND/OR

Does anyone know how to determine the field.rect of a form field?

(It is my fervent hope that this is a simple issue that has been well documented and that I am just too blind to see it)
 
I do not know if CFPDF offers this functionality. If not, it is possible using a newer version of iText. But you may want to verify CFPDF's capabilities first before going that route.
 
CFPDF and CFPDFFORM were the first places I looked. Thanks, though.

I haven't heard of iText. I'll have to take a look at it.
 
I LOVE the subtitle!!!

"Learning ColdFusion in the middle of the night"

Isn't that when everything breaks?
 
I really appreciate this help. I will take a look and let you know how it goes.

Thanks again.
 
Am I correct in my understanding that the iText software is free, but I have to purchase documentation?
 
I think I'm close, but I'm having a problem getting your example to work in my program. A couple of things to know...

Object Instantiation Exception.
An exception occurred when instantiating a Java object. The class must not be an interface or an abstract class. Error: ''.

The error occurred in /var/ line 24
Called from /var/ line 36
Called from /var/ line 24
Called from /var/ line 36

22 : imageURL = createObject("java", "java.net.URL").init("23 : outStream = createObject("java", "java.io.FileOutputStream").init(fullPathToOutputFile);
24 : pdfReader = javaloader.create("com.lowagie.text.pdf.PdfReader").init(fullPathToInputFile);
25 : stamper = javaloader.create("com.lowagie.text.pdf.PdfStamper").init(pdfReader, outStream);
26 : img = javaloader.create("com.lowagie.text.Image").getInstance(imageURL);


- The fullPathToOutputFile is working fine since I'm getting a 0-byte file created there.
- The fullPathToInputFile is the same.
- I have opened the PushButton.pdf to make sure it works.
- I have checked all of the paths for case sensitivity.

My server is on a Linux machine. Does that make a difference?

Do I have to have something else loaded for
com.lowagie.text.pdf.PdfReader?
 
OK, ignore the stupid question about Lowagie. I found the files and installed them.
 
Linux should not make a difference, if you have the correct permissions. Check the stack trace error. It may indicate a connection or firewall problem like unknown host.

Try the code with an image on your local file system instead.

// cfSearching: To use a local image file, replace the previous line with the one below
img = javaloader.create("com.lowagie.text.Image").getInstance(theFullPathToYourImageFile);




 
Unfortunately, no.

I'm not even getting to that point. I'm having problem creating the pdfReader object.

pdfReader = javaloader.create("com.lowagie.text.pdf.PdfReader").init(fullPathToInputFile);

It's acting like it can't find something. I inherited the Linux so, even though most Linux people know what they are doing, I'm not as comfortable with it as I would like to be.

*******

I found the lowagie files and put them in

/var/
since the loader says "com.lowagie.text.pdf.PdfReader," I assume that's where it needs to be?

There are only .java files, that's the way it should be, correct?

Is there anything else I need to do with these files?

*****

As for fullPathToInputFile, I verified that the file exists where I say it does (the same place the PushButtonWithImage.pdf file is being created.)

*****

Again, I thank you for your help. If this works, it is going to make a BIG difference in my project.
 
FOUND IT!!!

Who would have thought that the pdf file itself didn't have the right permissions.

It works now.

Thank you, thank you.
 
Glad it is working now.

I have not used Linux recently, but remember well that file permissions and case sensitivity were always my two "gotchas". Quite predictable with my windows background. It took some time to retrain myself ;-)



 
Great Blog by the way. I've subscribed and suggested it to a couple of other CF people I know. FWIW, I will make sure that you are given credit in my code.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top