Results 1 to 5 of 5

Thread: Asp To Pdf

  1. #1
    Join Date
    Apr 2006

    Asp To Pdf

    Hey all. I indicated in another thread that I would post the solution if I ever figured it out as to how to convert asp to pdf...well, I finally figured it out and I am posting it here for all to see. I am going to spell this out in a rediculously simple step-by step format so that hopefully no one gets hung up like I did. The adobe site is easy to get lost in and registering some of the files had me scratching my head for a while. I figured I would rather have too much info than not enough.

    Actually, this process isn't too difficult once you get everything you need. I guess I better clarify that this only works on my personal web server. If you want this to run off of the internet you will need to be able to to have the .dll's mentioned below, registered on the server you are running your site on. I have contacted my host server and I will post back any response from them as to whether or not that is feasible.

    Step 1:
    Before a file can be transformed from asp to pdf, the asp file must first be transformed into a fdf file. FDF stands for Form Definition File and is used by pdf files to display form data. Basically, FDF is just an easy and efficient way to communicate with pdf files. Ok, so now you are probably asking how do I get my asp file into a pdf file? Good question...see step 2.

    Step 2:
    Adobe understands that in order for people to want to use their product they need to offer resources to help out developers. So they offer a free resource so that you can turn your asp files into fdf documents. The only catch is that you have to fill out an application and then wait for approval. The process took about 2 weeks for me to get approved so keep this in mind as you are developing your site. You can apply for the right to the fdf toolkit on the adobe web-site at http://partners.adobe.com/public/de.../fdf/topic.html

    Click on one of the links on the right side (such as FDF Toolkit for Windows), you will then be directed to a screen where you will have to create an account with adobe. Once your account is created click on the following link:


    Fill out this application...be sure that you DON'T use a free web-based email system otherwise they will deny your application. Now patiently wait while they approve your application.

    Step 3:
    Once you are approved go back to the first link above and download the fdf toolkit. Once this is downloaded you must register two files. To do this open the "FDF Toolkit folder for Windows" and navigate to the following:

    Headers and Libraries > Win > FDFACX > FDFACX.Dll

    Now copy the FDFACX.Dll file and then navigate here:

    C: > Windows > System32

    and then paste the FDFACX.Dll file here.

    Now get the other .DLL file

    Headers and Libraries > Win > C > FDFTK.Dll

    Copy the FDFTK.DLL file and then navigate here:

    C: > Windows > System32

    and then paste the FDFACX.Dll file here.

    Step 4:
    Now you need to register these .dll files. To do this go to start > run and then either type in or copy and paste the following:

    regsvr32 fdfacx.dll

    If it registers properly you should get a message indicating that it succeeded. By registering the file above it should automatically take care of the other fdftk.dll file, but if you have problems you may try doing that one too: regsvr32 fdftk.dll

    Step 5:
    Now you are ready to create your pdf template. I am using adobe 6.0 so those are the steps I will be describing. I am not sure if there are major changes in other versions:

    Open adobe 6.0 and go to file > open and then select any document you want to export your asp data into.

    Now create the following 3 fields "firstname", "lastname" and "address". To do this you will need to make sure that the "Advanced Editing" toolbar is displayed. To make sure this toolbar is available go to:

    "View" > "Toolbars" > "Advanced Editing"

    You should see what looks like a gray rectangle with a drop-down arrow beside it. Click on the arrow and select "Text field tool". This will give you a sizeable rectangle that you can place anywhere on the document. Once you place the rectangle a "Text field properties" dialog box should appear (if not right-click on the field and select "properties"). Click on the tab titled "General" and name the field "firstname" and then click on "close". Do the same for the other fields.

    Once this is finished saved the document as demo1.pdf

    Step 5:
    Now you are ready to use an .asp page to convert asp info into fdf data and then open the pdf document so that the fdf data is displayed in the pdf form. Use the code below and then name the file demo1.asp

    <%@ LANGUAGE = VBScript%>
    '***   Create the FDF object.    
    Set FdfAcX = Server.CreateObject("FdfApp.FdfApp")
    Dim objFdf 
    Set objFdf = FdfAcX.FDFCreate
    '***   Set the location of the PDF file you create.
    objFdf.FDFSetFile "http://localhost/demo1.pdf"
    '***   Set the variables with data from the various Request 
    '***   data name/ value pairs posted from the HTML form. I'm using
    '***   rather verbose code here, hopefully to benefit beginners 
    address="1234 Nonyabusiness"
    '***   Use the FDFSetValue method to the PDF's name/value
    '***   where the value is one of the variables set above.
    objFdf.FDFSetValue "firstname", firstname, Off
    objFdf.FDFSetValue "address",address, Off
    objFdf.FDFSetValue "lastname",lastname, Off
    '***   Use the FDFSetStatus method to display an alert status box.
    objFdf.FDFSetStatus "Your Demo form has been created."
    '***   Write the data back to the buffer stream.
    Response.ContentType = "application/vnd.fdf"
    Response.BinaryWrite objFdf.FDFSaveToBuf
    '***   Close the object and clean-up.
    Set objFdf = Nothing
    Set FdfAcX = Nothing
    Now simply place both demo1.pdf and demo1.asp in your personal web server directory and run the demo1.asp page (http://localhost/demo1.asp). When you run the page the demo1.asp should open the pdf file you created and the fields should be completed with the information from above.

    I tried to keep this as simple as possible so everyone could get the example above working. However, you can see how easy it would be to modify this information. I set up my pages so that I am pulling a list of customers from my database. The user selects the customer and then all of their information is sent to a very clean and tidy pdf document that is easy to print and save as official records. For additional information check out the links below. I was able to get most of this information from theses sites, I simply put it together in a way that is hopefully more current and a bit easier to understand.




    I hope this information is beneficial to you. I had to go through the painful steps of figuring out this entire process. Little things like learning how to create the pdf form, downloading the fdf toolkit and registering the .dll's took forever because I had never really done them before. Please let me know if this information works or doesn't work for you.

    Good luck,
    Last edited by seanbennington; 05-04-2006 at 10:46 PM.

  2. #2
    Join Date
    Dec 2004
    Eau Claire, WI
    Do you know how to turn your newly created PDF into a "Press Optimized PDF?"

    I am working on something similiar, so THANK YOU very much for removing some of the guess work I was going to have to do..

    Brad Candell - Owner/Developer
    http://www.EauClaireWEB.com - Web Development

  3. #3
    Join Date
    Jun 2004
    Kansas City, MO
    nice work.

  4. #4
    Join Date
    Apr 2006

    PDF Optimizer


    I really haven't used adobe much except for just the basic conversion of documents into pdf format, so I only know the basics. I am not sure if the press optimizer and the PDF Optimizer option is the same thing, but if so I think you can simply create your document then go to the "Advanced" menu item and select "PDF Optimizer". Because the asp information is imported into the pdf form, that page should always be the same, just filled with different form data. So if you optimize it, everytime it opens it should be optimized.

    If not, you can also have the data imported into the pdf document and then go to Advanced > PDF Optimize and then save your document with a unique name.

    Let me know what you come up with for a solution as you have now made me contemplate optimizing my documents too.


  5. #5
    Join Date
    Sep 2015
    I wonder whether the pdf converter I am testing these days allows pdf to asp convcersion process. Any suggetsion will be appreciated. Thanks in advance.

    Best regards,

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.17369 seconds
  • Memory Usage 2,892KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (5)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates