设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 数据 手机
当前位置: 首页 > 站长学院 > Asp教程 > 正文

用asp生成PDF文件(英文)(2)

发布时间:2020-12-25 08:43 所属栏目:120 来源:网络整理
导读:Open the document in Adobe Acrobat. Click the form tool. Paint your first form field (First Name). As soon as you''ve defined it you are asked to name it. I named mine FirstName. Note that there are


Open the document in Adobe Acrobat.
Click the form tool.
Paint your first form field (First Name).
As soon as you''ve defined it you are asked to name it. I named mine FirstName. Note that there are several additional formatting options. Other than font size,I choose to do my validation and formatting in my ASP document. As this is just a quick demo,I have opted to skip any validation. However,I would handle it on the client side in my form and any formatting server side in my ASP page before I pass the variables.
Continue with the remaining fields,naming each and possibly formatting the font size or attributes.
Save your work to wherever you want on your Web server.
Step 5. Write the ASP page.

Before you start,realize that there is one main object exposed by the FDF toolkit - "FDFApp.FDFApp." There are many methods exposed,and the manual outlines some other possibilities. We''re mainly concerned with two methods,fdfSetValue and fdfSetFile. Here we go,


<%@ Language=VBScript %>
<% Response.Buffer = true%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<%
''
''?Retrieve the user responses
''
FirstName = Request.form("txtFirstName")
MI = Request.form("txtMI")
LastName = Request.form("txtLastName")
SS1 = Request.form("txtSocial1")
SS2 = Request.form("txtSocial2")
SS3 = Request.form("txtSocial3")
StreetAddress = Request.form("txtStreetAddress")
City = Request.form("txtCity")
State = Request.form("txtState")
Zip = Request.form("txtZip")
FilingStatus = Request.form("radFilingStatus")
Allowances = Request.form("txtAllowances")
Additional = Request.form("txtAdditional")
Exempt = Request.form("chkExempt")
If Exempt = "on" Then
?Exempt = "EXEMPT"
Else
?Exempt = ""
End If
''
''?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 "FirstName",FirstName,false
myFdf.fdfsetvalue "MI",MI,false
myFdf.fdfsetvalue "LastName",LastName,false
myFdf.fdfsetvalue "SS1",SS1,false
myFdf.fdfsetvalue "SS2",SS2,false
myFdf.fdfsetvalue "SS3",SS3,false
myFdf.fdfsetvalue "StreetAddress",StreetAddress,false
myFdf.fdfsetvalue "City",City,false
myFdf.fdfsetvalue "State",State,false
myFdf.fdfsetvalue "Zip",Zip,false
If FilingStatus = 1 Then
?MyFdf.fdfsetValue "StatusSingle","X",false
End If
If FilingStatus = 2 Then
?MyFdf.fdfsetValue "StatusMarried",false
End If
If FilingStatus = 3 Then
?MyFdf.fdfsetValue "MarriedBut",false
End If
myFdf.fdfsetvalue "Allowances",Allowances,false
myFdf.fdfsetvalue "Additional",Additional,false
myFdf.fdfsetvalue "Exempt",Exempt,false
''
''?Point to your pdf file
''
myFDF.fdfSetFile "http://www.servername.com/workorder/w4.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 "C:inetpubwwwrootworkorderCheckThis.fdf"
'' Now put a link to the file on your page.
Response.Write "<a href=http://www.servername.com/workorder/CheckThis.fdf>pdf</A>"
''
''?Close your Objects
''
myfdf.fdfclose
set fdfacx = nothing
%>


?
Conclusion
Without having to be an expert at FDF or PDF,this is my answer for the moment. The users?guide that comes with the toolkit outlines all of the methods and looks like it has many possibilities beyond this rudimentary introduction. As you can see,you could just as easily add database commands to collect the data and log it to a database.?
About the Author
Ty Button is employed by Cardinal Services,Inc.,a staffing firm in Oregon. Cardinal Services has been named the #1 Staffing Firm in Southern Oregon for both 1997 and 1998 by Oregon Business Magazine,as well as Oregon''s Fastest Planned Growth Company by the South Coast Business Development Center and U.S. Bank. Button is the MIS,but spends the bulk of his time on Web-database development and process automation. He can be reached at mailto:ty@ty-button.com.?

(编辑:ASP站长网)

网友评论
推荐文章
    热点阅读