Solved

PDF Form Im slamming my head on a wall

Posted on 2004-04-16
11
921 Views
Last Modified: 2008-02-01
Ok after a couple of questions here at EE and A LOT of googleing I think Ive come up with a plan.  
Here is what needs to be done:
Client opens the pdf form via web browser
CLient fills out the form
On submit Acrobat Reader exports the fields in FDF format.  (I wanted to export an entire PDF but it seems that the reader which most people have wont do this)
This is where it gets fuzzy for me
Now that the form has been exported I dont know what to do with it.  I need to make this as easy and painless as possible for the office staff that recieves the form.  What would be the best way to go about this?  
1.  Send the FDF info via email attachment to the office where they could manually use the import function to fill in a blank form using the FDF info. (not great because it requires the full version of Acrobat which the office doesnt have)
2.  Use a server side script that will take the fdf info and fill a blank form and either sned the completed pdf to the office or send a link to the pdf on the server.


HELPPPPPP, Im going crazy trying to figure this out.  I cant possibly be the first person that ever wanted to do this.!!!!

Thanks

yan
0
Comment
Question by:livegirllove
  • 7
  • 4
11 Comments
 
LVL 1

Author Comment

by:livegirllove
ID: 10844391
Just found this app:
http://www.appligent.com/products/applications/fdfmerge/fdfmerge.html

$1000 AGHHHHHHHH   I have a hard time believing that after spending $700 on acrobat Pro I now have to spend another 1000 to make the form feature usable.  There has to be another way.

thanks
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10844495
You are right, Reader does not support submission of the whole PDF. Reader never came up in your last question, you said that you have Acrobat 6 Professional, so I just assumed that this is what you were using. Sorry about that. I should have asked.

It looks like you are already ruling out #1, because it requires the full version of Acrobat. For option #2 you need a tool that can merge FDF and PDF files on the server. Acrobat cannot be used for this because of licensing restrictions (you cannot use Acrobat on a server - with one exception, but this again would require that all your users have the full version of Acrobat). One example for such a tool is FDFMerge (http://www.appligent.com/products/applications/fdfmerge/fdfmerge.html)

There is a third option (and I briefly talked about this in your previous question): Your users would download the FDF file from the web server. This FDF file contains a /F (http://.....pdf)  record that points to the PDF file it's generated for. When Acrobat (and Reader) is opened with the FDF file, it will automatically retrieve this PDF document and merge the FDF file into the PDF file. With Reader all you can do is modify the data and submit ti again, or print the document. You cannot save the modified document. If this is a requirement, this method does not work, but if you can make sure that the PDFs are always downloaded when they are needed, this will work.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10844666
Here is a document from Adobe's web site that has some background information about forms (it's for Acrobat 5, but still valid):
http://www.adobe.com/products/acrobat/pdfs/FormSys.pdf
You may find more forms related information here: http://www.adobe.com/products/acrobat/eforms.html
BTW: I did not see your comment when I posted my last comment. Otherwise I wouldn't have posted the link to FDFMerge. But, go to the site again and look at FDFMerge Light. It may be all you need.
0
 
LVL 1

Author Comment

by:livegirllove
ID: 10844687
Ok they only need to be printed for the files.  SO keeping a digital copy is not nessecary.
######Your users would download the FDF file from the web server.######
By user I assume you mean the staff in the office and NOT the client filling out the form?
######This FDF file contains a /F (http://.....pdf)  record that points to the PDF file it's generated for#######
Need more info, please.  Im slow sometimes.  I do great once Ive seen it in action ;-)
######When Acrobat (and Reader) is opened with the FDF file, it will automatically retrieve this PDF document and merge the FDF file into the PDF file.#######
Sounds good, thats what I need.  I could possibly get the office to buy a copy of acrobat if they really want to save the forms as pdfs.  Right now they just need them printed.
######With Reader all you can do is modify the data and submit ti again, or print the document.######
That works, it wont need to be resubmitted just printed.  If they want to save as a pdf theyll have to buy acrobat.
######but if you can make sure that the PDFs are always downloaded when they are needed, this will work.######
What do you mean by that.  If the form is filled out by 10 clients overnight, are they going to overwrite each other?  

Thanks a lot khkremer, we may beat this nightmare yet!!  ;-)
 

0
 
LVL 1

Author Comment

by:livegirllove
ID: 10844703
Didnt see your last post.  FDFMerge lite is $1000 wihich is out of the question.

Ill check those links

thanks
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 1

Author Comment

by:livegirllove
ID: 10845042
Read both of those links.  They dont like to make things easy do they?  They clearly layout what needs to be done in asp on IIS but nothing really about linux/apache/php or cgi.  

Let me tell everyone, once I get this figured out Im going to package it and put it on a site for free download.  This is ridiculous that there isnt a free script readily available for this.  SOmething like formmail.pl except for FDF.  

 Im ranting here but I just spent $700+ for acrobat.   Not a lot for a big company but Im just a little guy trying to pay rent ;-) And Im really not stupid, I can usually cut& paste something together that will work.  But I havent even got a good starting point.  
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 10845744
The document give some background information about how the whole forms processing with Acrobat/PDF works. If you payed more than $700 for Acrobat Professional, somebody ripped you off: List price is $449 (that is, here in the US).
But, rant as much as you like, I am not working for Adobe, and I know that Adobe has some problems making some of the great features of Acrobat accessible to "normal" users.

Now let's talk about the /F "stuff". It's probably best explained with a real FDF sample, so open up your Acrobat and open a document that you can "destroy" by adding a form field. Select the Text Field tool and create a text form field on the first page. This will bring up the properties window. Just accept the defaults for now (you may want to change the color of the border so that you can find the field again :-). Enter some data into the form field. Save this file as e.g. FormField.pdf
Without closing the document select the "Advanced>Forms>Export Forms Data" menu item. Save the data as e.g. FormField.fdf.
Close your PDF file again. Open the FDF file in a text editor.

This file will look something like this:
%FDF-1.2
%‚„œ”
1 0 obj
<</FDF<</F(FormField.pdf)
/ID[<31155cbf8fe111d8a5f3000a957e40e8><b9d72a6c8fe111d8a5f3000a957e40e8>]
/Fields[<</T(Text3)/V(abc)>>]>>>>
endobj
trailer
<</Root 1 0 R>>
%%EOF

To make things easier to explain, I've inserted line breaks. They don't change the behavior of the file.
The first line identifies this as a FDF file (FDF version 1.2), the second line is a comment with some binary data to make sure that programs that process binary files differently than text files will interpret this as a binary file.
The following line contains a object number (number 1, generation 0), which starts a new object in the file. Let's skip to the end of the file: The last line marks the end of the file, and the two lines just before that identify the trailer of the file containing a pointer to the root object. In this case, we only have one object in the file, and this is our /Root object.
The grouping in the file is done with << and >> - these actually identify the start and end of dictionaries.

The remaining part of the file contains the actual /FDF dictionary with an the /F key, the /ID (this is optional) and a /Fields dictionary, which contains all fields (and values) that are in the file.
You will find the characters you've entered in your form field in this form:
/T(Text3)/V(abc)
This means the field named "Text3" contains the value "abc".
Now the last remaining piece is the /F key. This points to the PDF file. Because you saved the FDF file in the same directory as the PDF file, we only have a file name, without a path.

Do you have access to a web server  you can play with? If so, upload the PDF file to this server (e.g. as http://myserver/FormField.pdf). Then change the file name in the FDF file to http://myserver/FormField.pdf (BTW: '(' and ')' are the string delimiters, no need to use quotes). Change the /V key to something different and save the file.

Double-click on your FDF file. This should bring up Acrobat and automatically download the PDF file and fill in the information you've specified in the FDF file.

Now, all you need to do is automate this :-)

Does this explain FDF files and the role the /F key plays?

 




0
 
LVL 1

Author Comment

by:livegirllove
ID: 10847273
Ok Let me see if I get this.  Great post btw!!  I have exported to fpf once to the same directory and once to a different directory and the file path to the pdf changes!!  Im doing this on my local pc btw.  So

Do you have access to a web server  you can play with?
Yes.

If so, upload the PDF file to this server (e.g. as http://myserver/FormField.pdf).
Done

Then change the file name in the FDF file to http://myserver/FormField.pdf (BTW: '(' and ')' are the string delimiters, no need to use quotes). Change the /V key to something different and save the file.
Ok did that worked perfectly!!  

What Im not sure of is if I use the submit button to export a fdf, i can have php put a timestamp in the name of the file so each fdf gets a different name.  BUT when the fdf gets sent via email to the office the url in the /F key is not going to be correct, will it?  Or will it put the full path to the pdf? eg. http://site.com/test.pdf  
Can you define that field somewhere when you are creating the form?  Or do you have to use a script to open the fdf change to a full path and resave?  

Again that last post was great, thanks!!
0
 
LVL 1

Author Comment

by:livegirllove
ID: 10847458
GOT IT!!!! Heres the code Im useing, Works great!!  It does put the correct path automatically in the fdf, so that worked out great.  Now I just have to put the timestamp in the name so that they dont over write each other if the doctor wants to leave the files on the server.  Although for just emailing it works fine as is.  
thanks again.!!!!
<?
$fptr = fopen("/tmp/temp.fdf", "w");
fputs($fptr, $HTTP_RAW_POST_DATA);
fclose($fptr);
?>
<?php
include('Mail.php');
include('Mail/mime.php');

$text = 'Form From Patient';
$html = '<html><body>Form From Patient</body></html>';
$file = "/tmp/temp.fdf";
$crlf = "\r\n";
$hdrs = array(
              'From'    => 'testt@test.com',
              'Subject' => 'Test mime message'
              );

$mime = new Mail_mime($crlf);

$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');

$body = $mime->get();
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$mail->send('test@test.com', $hdrs, $body);
?>
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10848576
Great.

I don't want to make things more complicated, but one other option is to save the data that is returned in a database. In this case, you would either take the FDF file and parse it, extract the data and save it. When a client connects, you would then create the FDF file from scratch (as you now know, the format is really simple).
0
 
LVL 1

Author Comment

by:livegirllove
ID: 10849279
Yes I thought about that.  But with all the rules about patient privacy storing it on an unsecured server wouldnt be good.  

Thanks again!!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe INTRODUCTION This Article is a follow-up to the Article entitled How To Rename-Move a Batch of PDF Files Based o…
PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now