Link to home
Start Free TrialLog in
Avatar of Melfeky
Melfeky

asked on

I want the user to enter data in an ASP form and when submitted it is populated in a PDF file

Hello all experts,
I want the user to enter data in a form and when submitted it is populated in a PDF file.
Where the user will have a link saying "Print Your File" which when licked the data that was saved into the form will be populated into pdf file.
I am using ASP,Access db.
I need to use a  simple code  or even a FREE software
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is some information about how to use the FDFToolkit to create FDF files from a database: https://www.experts-exchange.com/questions/21130800/Create-a-fdf-file-with-asp-from-database.html

You can get the FDFToolkit from Adobe: http://partners.adobe.com/asn/acrobat/forms.jsp
Avatar of Melfeky
Melfeky

ASKER

Thanks khkremer ,
but when i went to the adobe site to download the fdf toolkit the link is not working it is just downloading an empty file of 18kb, would u provide another link to get this source.
Avatar of Melfeky

ASKER

-And by the way this website http://www.pdfeverywhere.com/pdfform.html  uses Perl and i am using ASP.
If you have any other source that would be greate.

-When i went to the other link that u provided u have said this
 " (I create FDF files from scratch, the format is pretty simple, and does not really warrant the overhead of the toolkit). "

What would i need to be installed on my pc to create FDF files and how would i create it without FDF toolkit?
Thanks.
The tools from pdfeverywhere.com are actually Windows executable, and you should be able to run them on your server from within your ASP code. Download the documentation, it has some examples about how to use the program (it's a command line program, so it expects all parameters on the command line).

The FDF Toolkit can be downloaded, I just tried it. You probably just did a "Save Link as" and did not click on the link. In your other question, I provided some more information about how to download the FDFToolkit.

You can create FDF files from within your ASP code. Look at the experts-exchange.com link I provided, it does contain some sample code. The following discussion may also be useful. I don't program in ASP, and have just a very rough understanding of how it works, so I may not be the right source for more information about how to use it in ASP. The idea is that you just write out the FDF code to a temporary FDF file on your server. It's just a text file, and you only have to make sure that you are using the correct syntax (this is where the FDFToolkit helps: It automatically creates syntactically correct files).

Do you have access to the full version of Acrobat? If so, try to create a form, fill in some data, and export the form data as FDF by selecting "Advanced>Forms>Export Forms Data".
Avatar of Melfeky

ASKER

Ok i have registered at the adobe site, but when  i click the login link and open the page i get the same result.
I would like to ask u when u login and open this page do u still see the Login link at the top of the page ? as i do.
Avatar of Melfeky

ASKER

Ok the problem was the download accelerator ,when disabled i could download.
I will let u know what i understand from this toolkit as soon s i complete downloading.
Thanks
Avatar of Melfeky

ASKER


i have registered the .dll as the toolkit said , but there is a problem how can i create a pdf form that have all the fields and data in an html document?
Would u tell me in details as i am new to pdf.
thanks
Avatar of Melfeky

ASKER

And by the way i am using Acrobat Reader 6.0 version.
Avatar of Melfeky

ASKER

My client had provided me today with pdf forms with all the lables and fields, how can i start now? and how can i know the name of the fileds in those forms?
You need the full version of Acrobat to extract the all the field information you need (e.g. field name, field type, valid selections, ...). Or, your customer has to provide this information outside of the PDF file (e.g. API documentation for this document).

The forms features are only in the Professional version of Acrobat 6. If you can get a copy of Acrobat 5, this will be sufficient. You can download a 30 day eval version of Acrobat 6 Pro from Adobe's web site: http://www.adobe.com/products/acrobatpro/tryout.html

There is a mechanism to at least get access to the field names by using a JavaScript program. I can give you something that does this, but need to get the script first from a different machine.
Actually, I already provided this information on EE earlier. Take a look at this question (the script is towards the end of the page): https://www.experts-exchange.com/questions/21130095/Get-Field-names-from-a-PDF-Form.html?query=extract+form+fields&topics=246

This question also has a reference to the Enfocus Browser, You can also use that to get access to the information about the form fields.
Avatar of Melfeky

ASKER

Hi khkremer,
u have said in the topic that u posted above " You can however open the file in the standalone - or application - version of the Enfocus Browser (http://www.enfocus.com/support/knowledgeBase/browser.php)"
So can i just use this to get the names of the fileds of the PDF  form without having Adobe professional?
Avatar of Melfeky

ASKER

I have added a javascript file as u have said in the link u sent and its true when i opened the file i could see a list of all the field name in the document but how would i know for example that the field "1" is for first name  and field "44" is for age?
as all the field names are listed all together.
thanks.
Whoever created the document did not use good field names. If you just number the fields, it's really hard (impossible?) to figure out what the fields actually are. In this case, not even the Enfocus Browser would help you because you don't have any idea where the field is (without actually mapping out the form).

Download the trial version of Acrobat and use that to analyze the form. All you have to do in Acrobat is to select the forms tool, and you will see the fields names right in the middle of the individual forms.
Avatar of Melfeky

ASKER

Hello khkremer ,
I have downloaded the Adobe professional and it shows the field names as u have said.
But the problem is that i cann't add fields to this document ?Is there anyway to edit the contents of this document as my clients want me to add fields in it that also will be populated from the database?Do this have anything with the security of the document and if so how can i solve this?
Thanks,
After you open the document in Acrobat, select "File>Document Properties>Security". Does this dialog indicate that the document is protected?
Avatar of Melfeky

ASKER

I have found "Security Method:Password Security"
but i changed it to "No security".
I have something like this:
"Answer the following belowIs the firm delinquent in filing any applicable business tax returns?  YES      NO
if u choose YES , you should add full explanation in the following field ."


The problem is that i need to add  field below this question where the user should add explanation about his tax return.
Change the setting to "No security" and then do a "Save As". The new security settings are applied only when you save the document. Close the document and open the new document. If it does not allow you to do this, you need to provide the password that was set when the document security was first applied.
Avatar of Melfeky

ASKER

I have done that , and fortunatly i could add fields, but how add a new line of text between two already  text lines and add a field into this new line between them?
I don't understand your question. Do you know how to add a field?
Acrobat is not a document creation application, you should add any static information in the application in which the document was initially created. If this is not an option, you can do some minor text touchup operations with the TouchUp Text tool. Select this tool and hold down the control key when you click on the document. This will create a new text element. You can find the TouchUP Text tool by selecting "Tools>Advanced Editing>TouchUp Text Tool"
Avatar of Melfeky

ASKER

Hello khkremer :
I have made an ASP page with some of the fields in the pdf file to save it to it through a fdf file, when i submit the form a get a link when i click it it opens the fdf file but empty while when i open it in notebad it contains the data that i actually entered into the form.
When i change the link to point to the pdf file the pdf file is opened in the browser but empty.
Here is the code of the Asp file:
<%
'
'      Retrieve the user responses
'
txtName_of_Firm = Request.form("txtName_of_Firm")
txtTelephone = Request.form("txtTelephone")

'      Create an instance of the Object
'
Set FdfAcx = Server.CreateObject("FdfApp.FdfApp")
'
'       Use the fdfApp to feed the vars
'
Set myFdf = FdfAcx.FDFCreate
'
'      Stuff the variables
'
myFdf.fdfsetvalue "txtName_of_Firm", txtName_of_Firm, false
myFdf.fdfsetvalue "txtTelephone", txtTelephone, false
'
'      Point to your pdf file
'
myFDF.fdfSetFile "D:\inetpub\wwwroot\pdf\sbaforms.pdf"
Response.ContentType = "text/html"
'
'      Save it to a file.  If you were going to save the actual file past the point of printing
'      You would want to create a naming convention (perhaps using social in the name)
'      Have to use the physical path so you may need to incorporate Server.mapPath in
'      on this portion.
'
myFDf.FDFSaveToFile "D:\inetpub\wwwroot\pdf\checkthis.fdf"
' Now put a link to the file on your page.
Response.Write "<a href=D:\inetpub\wwwroot\pdf\checkthis.fdf>pdf</A>"
'
'      Close your Objects
'
myfdf.fdfclose
set fdfacx = nothing
%>
Do you want to serve the FDF file to the user, or was the idea to send a flattened PDF file? In the first case, the user could potentially change the field values before printing the document.

As I stated before, I don't use ASP and I don't think I'm in a position to debug your ASP program. What I can do however is look at your FDF file and debug that.

What happens when you open the FDF file? Does the PDF file open? Do you get a blank page?

What happens when you download the FDF file to your disk and open it from there?

You can post the contents of your FDF file here. You may want to edit it first and add some line feeds. As long as  you are not adding a line feed in the middle of a string, you are not changing the behavior of the FDF file.
Avatar of Melfeky

ASKER

Ok now when i link the link the fdf file calls the pdf file and here is what happens:
when i open the pge and click the link for the first time the data is sved into the pdf file and displyed correctly.
But when i open the page again and click the link the pdf file is opened with the old data entered before and the new data dosn't overwrite the old ones.
Here is the code in the FDF file:
%FDF-1.2
%â&#1605;&#1583;&#1587;
1 0 obj<</FDF<</F(http://localhost/pdf/sbaforms.pdf)/Fields 2 0 R>>>>
endobj
2 0 obj[<</T(txtName_of_Firm)/V(Fatma El Zahraa)>><</T(txtTelephone)/V(22)>>]
endobj
trailer
<</Root 1 0 R>>
%%EOF
I did verify that your PDF file is good, which you also confirmed by the fact that the document is filled in correctly (the first time).

Do you want to merge the contents on your web server (so that the user cannot change the field contents), or do you just want to download the FDF and the PDF and have Reader/Acrobat do the merging?

There is a setting in Acrobat/Reader that controls if the data should be cached or not. You can turn this off by going to "Edit>Preferences>General>Forms" and deselect "Keep forms data temporarily available on disk", you should no longer have this problem. But, beccause you don't have access to your clients PCs, you will not be able to make this change for them. This is another reason why it's better to do the merging on the server.

Here is another link to a command line tool that can do the merging and flattening for you: http://www.accesspdf.com/pdftk/

All you have to do, is to run this program (or the one I gave you before) in your ASP program and then send the PDF file to the client intead of the FDF file.