Solved

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

Posted on 2004-10-29
280 Views
Last Modified: 2008-01-16
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.
0
Question by:Melfeky
    25 Comments
     
    LVL 44

    Accepted Solution

    by:
    You can get a forms merge tool, and a form flattening tool at http://www.pdfeverywhere.com/pdfform.html They have a public beta right now, so the software can be downloaded for free. If the page does not work right away, retry it a few times, they are also working on the web site and it's a bit unreliable. But, it's the cheapest way to get this to work. A more expensive solution is FDFMerge: http://www.appligent.com/newpages/fdfmerge.html

    This software allows you to take a FDF file and merge it into a PDF file with form fields. Once this is done, you flatten the file so that it does no longer contain interactive form fields.

    The trick now is to convert your forms data to FDF. You can find information about the FDF file in the PDF Specification, but the format is pretty simple, and you can probably reverse engineer it by just looking at some FDF files that you can create with the full version of Acrobat.
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    Here is some information about how to use the FDFToolkit to create FDF files from a database: http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21130800.html

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

    Author Comment

    by:Melfeky
    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.
    0
     

    Author Comment

    by:Melfeky
    -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.
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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".
    0
     

    Author Comment

    by:Melfeky
    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.
    0
     

    Author Comment

    by:Melfeky
    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
    0
     

    Author Comment

    by:Melfeky

    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
    0
     

    Author Comment

    by:Melfeky
    And by the way i am using Acrobat Reader 6.0 version.
    0
     

    Author Comment

    by:Melfeky
    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?
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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.
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    Actually, I already provided this information on EE earlier. Take a look at this question (the script is towards the end of the page): http://www.experts-exchange.com/Web/Graphics/Adobe_Acrobat/Q_21130095.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.
    0
     

    Author Comment

    by:Melfeky
    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?
    0
     

    Author Comment

    by:Melfeky
    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.
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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.
    0
     

    Author Comment

    by:Melfeky
    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,
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    After you open the document in Acrobat, select "File>Document Properties>Security". Does this dialog indicate that the document is protected?
    0
     

    Author Comment

    by:Melfeky
    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.
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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.
    0
     

    Author Comment

    by:Melfeky
    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?
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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"
    0
     

    Author Comment

    by:Melfeky
    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
    %>
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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.
    0
     

    Author Comment

    by:Melfeky
    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
    0
     
    LVL 44

    Expert Comment

    by:Karl Heinz Kremer
    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.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Lean Six Sigma Project Manager Certification

    There are many schools of thought around successful project management, but few as highly regarded as the Six Sigma and Lean methods. With 37 hours of learning, this training will explain concrete processes for increasing efficiency and limiting wasted time and effort.

    Suggested Solutions

    PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
    Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
    In this second video of the Xpdf series, we discuss and demonstrate the PDFimages utility, which, in a single command, is able to extract all the images from a PDF file and save each one in a separate image file (PBM, PPM, or JPG). Download and inst…
    In this video, we show how to perform Bates Numbering/Stamping of PDF documents using Power PDF Advanced, the newest product from the Document Imaging division of Nuance Communications. There are two editions of Power PDF — Standard and Advanced. Th…

    884 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

    17 Experts available now in Live!

    Get 1:1 Help Now