These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

updatng a document when it is opened

adoacr
Registered: May 4 2011
Posts: 41
Answered

Hi,
 
Im looking to update data points like graphs and tables in
a document when it is opened. I could call a web service or
a servlet from javascript and rturn an FDF response, but how
do I update specific parts of the document itself? or should
I just update the whole document?
 
Cheers

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
From a script you cannot modify PDF page content with that level of granularity. PDF just isn't that kind of format. It's much more old fashioned, much like a piece of paper.

To modify text you'll need to put form fields over the table, and there are options for placing a graph on an annotation that can be modified dynamically. For example, the "PolyLine" and "Ink" annots can be used for creating a simple line graphs. I've also seen bar charts created with "Square" annots. There's a very sophisticated example that uses a Flash app run inside an Rich Media Annot here:

http://blogs.adobe.com/pdfdevjunkie/category/acrobat/rich-media-annotations
But you'll have to look around some. I know it's in there somewhere.

Here's an example of using an undocumented function for drawing directly onto a button with standard PDF content operators. Everything on a PDF page is drawn with these operators.

2D Matrix Calculator

So there are several options, from the simple to the complex. But what you can't do is modify the page content.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
To change content in an area of a page, you can use a button to display the content and use FDF to update the button. A button appearance can be anything a PDF page can be, so it can include text, graphics, images, etc. The hard part is getting the button appearance in the FDF. This is easy if you can use the old FDF Toolkit or if the content you want does not have to be created dynamically. What I mean by that last part is you can create a collection of static content (PDFs) on the server and link to a page within the FDF.

It's a shame Adobe doesn't support/update the FDF Tookit any longer. This is one of its most useful FDF creation features.
adoacr
Registered: May 4 2011
Posts: 41
How about updating the pdf whole itself? cant I check for a later version and retransmit a new pdf to open instead or would the FDF be too complex to write? any pointers or sample code?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
It might actually be easier to send a new PDF. I haven't experimented with replacing a PDF, but I think that all you need is an FDF with a new file reference. Or maybe you could return a PDF in the body of the HTTP Response instead of an FDF. Haven't tried this one.

Another approach would be to use the "app.launchURL" function to ping a server script with the file version info and then return a PDF, which would display in the browser.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script