加入收藏 | 设为首页 | 会员中心 | 我要投稿 网站开发网_安阳站长网 (https://www.0518zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

用asp生成PDF文件(英文)

发布时间:2020-12-26 01:19:19 所属栏目:站长百科 来源:网络整理
导读:副标题#e# Creating a PDF with ASP By Ty Button Introduction Adobe''s PDF format has become the lingua franca of cross-platform reporting for many agencies and companies. While I was no great fan of the product,I have to admit it probably


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
%>

(编辑:网站开发网_安阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!