ASP网站制作之用asp天生PDF文件
缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全CreatingaPDFwithASPByTyButton
printthisarticle
emailthisarticletoacolleague
Introduction
AdobesPDFformathasbecomethelinguafrancaofcross-platformreportingformanyagenciesandcompanies.WhileIwasnogreatfanoftheproduct,IhavetoadmititprobablydoesabetterjobofproducingacompactdocumentwithloadsofformattingthanWordeverwill.
GettingStarted
Workingforastaffingfirm,Ihavewrittenallofourfront-endsoftwaretorunovertheInternetsowecansharecommondatabaseswithoursmallerbranchoffices.Thebiggestproblemwefaced,however,wasreporting.Howdowegetlivedocuments(applications,etc.)togeneratethemselveswhenanapplicantsitsdownatthekioskandfillsouttheiron-lineemploymentapplication?Whileweredoingagreatjobofcapturingthedata,westillneedanapplicanttosigntheapplication,W-4,etc.
Itriedanumberofthings,butthelimitsseemtobe:
IfIcouldproduceitfast,itwasanHTMLformderivativeandlookedterriblewhenprinted.
IfIcouldproduceitlookingright,itwasclunkyandslow.ThisisbecauseIsettledonRTFasmybestinitialoptionandendedupusingtheFileSystemObjecttowriteRTFfilesbasedonatemplateandparsemyinfointothem.Thediskreadsandwritestooktheirtoll.
Remember,werenottalkingabouttabulardataoranExcelspreadsheet.Wewanttheapplicationwithourlogotobeprocessed.
Finally,IsettledonAdobe.IhatetheviewerandwishIdidnthavetomesswithit.However,theformattinglooksgoodandthefilesarethin.Mostusershaveitontheirsystem,andallmyusersdo.
SoIsearchedandsearchedforwaystopassdatafromHTMLformstoPDFfiles.ItriedusingAdobeforms,butdidntreallylikeworkingwiththevalidation,etc.,andthenwouldstillhavetofigureouthowtoincorporatethedatabasecalls.ThiswasntatallwhatIwanted.IwantedtopassdatadirectlyfrommyHTMLformtoadatabasewhilegeneratingthefielddataintothePDFfilefordisplayorprinting.
Finally,therewasaclueonUseNet.AlinkpostedbyJeremyHuntercontainedmuchofwhatIwilladdresshere.http://partners.adobe.com/asn/developer/acrosdk/forms.html
REQUIREDSOFTWARE
ADOBE(thefullversion)isrequiredontheworkstationdefiningthefields.(Nottheserver)
ThisisthelinktotheAdobeFormsAcrobatToolkit.Fromthereitwaseasygoing.
Step1.Downloadthetoolkitandunzipittoyourdirectoryofchoice.
Whenyoudo,youllfindthatallthesourcecodeisincludedinVBandC++.Werenotgoingtoworryaboutthathere,butthecodeisthereifyouneedit.
Step2.Registeryourdlls.
Twodllsneedtobecopiedtoyourserver.ThefirstisintheVisualBasicsubfolderandisnamedfdfacx.dll.ThesecondisintheVisualCsubfolderandisnamedfdftk.dll.Runrefsvr32onthefdfacx.dllfile.Itwilltakecareofregisteringtheotheritself.Iputbothinc:winntsystem32andfromthatdirectorytypedregsvr32fdftk.dll.Ifyougetanerrormessage,checktomakesurebothfilesarereallythere.Ifnot,weresettogo.
Step3.Createtheform.
Welluseaformeveryoneistoofamiliarwithforthisdemonstration-theW-4.Thisoneisreadilyavailableonhttp://www.irs.govandgivesusenoughfieldstoshowwhatwecando.
<%@Language=VBScript%>
<HTML>
<HEAD>
<METANAME="GENERATOR"Content="MicrosoftVisualStudio6.0">
</HEAD>
<BODY>
<H1>AdobeFDFExample</H1>
<FORMNAME=W4HelpACTION=W4.aspMETHOD=POST>
<TABLE>
<TR>
<TDALIGN=RIGHTVALIGN=TOP>FirstName</TD>
<TD><INPUTTYPE=TEXTNAME=txtFirstName>
</TD>
</TR>
<TR>
<TDALIGN=RIGHTVALIGN=TOP>MiddleInitial
</TD>
<TD><INPUTTYPE=TEXTNAME=txtMI>
</TD>
</TR>
<TR>
<TDALIGN=RIGHTVALIGN=TOP>LastName</TD>
<TD><INPUTTYPE=TEXTNAME=txtLastName>
</TD>
</TR>
<TR>
<TDALIGN=RIGHTVALIGN=TOP>Social</TD>
<TD><INPUTTYPE=TEXTNAME=txtSocial1SIZE=3>-
<INPUTTYPE=TEXTNAME=txtSocial2SIZE=2>-
<INPUTTYPE=TEXTNAME=txtSocial3SIZE=2></TD>
</TR>
<TR>
<TDALIGN=RIGHTVALIGN=TOP>StreetAddress</TD>
<TD><INPUTTYPE=TEXTNAME</p>ActiveServerPage技术为应用开发商提供了基于脚本的直观、快速、高效的应用开发手段,极大地提高了开发的效果。在讨论ASP的安全性问题之前,让我们来看看ASP是怎么工作的。 ASP主要是用好六个对象,其实最主要的是用好其中两个:response和request,就可以随心所欲地控制网页变换和响应用户动作了。 运用ASP可将VBscript、javascript等脚本语言嵌入到HTML中,便可快速完成网站的应用程序,无需编译,可在服务器端直接执行。容易编写,使用普通的文本编辑器编写,如记事本就可以完成。由脚本在服务器上而不是客户端运行,ASP所使用的脚本语言都在服务端上运行。 ASP.Net和ASP的最大区别在于编程思维的转换,而不仅仅在于功能的增强。ASP使用VBS/JS这样的脚本语言混合html来编程,而那些脚本语言属于弱类型、面向结构的编程语言,而非面向对象,这就明显产生以下几个问题: 那么,ASP.Net有哪些改进呢? ASP.Net摆脱了以前ASP使用脚本语言来编程的缺点,理论上可以使用任何编程语言包括C++,VB,JS等等,当然,最合适的编程语言还是MS为.NetFrmaework专门推出的C(读csharp),它可以看作是VC和Java的混合体吧。 学习ASP其实应该上升到如何学习程序设计这种境界,其实学习程序设计又是接受一种编程思想。比如ASP如何学习,你也许在以前的学习中碰到过。以下我仔细给你说几点: 不是很难但是英文要有一点基础网上的教程很少有系统的详细的去买书吧,另不用专门学习vb关于vbscript脚本在asp教材都有介绍 先学习用frontpage熟悉html编辑然后学习asp和vbscript建议买书进行系统学习 运用ASP可将VBscript、javascript等脚本语言嵌入到HTML中,便可快速完成网站的应用程序,无需编译,可在服务器端直接执行。容易编写,使用普通的文本编辑器编写,如记事本就可以完成。由脚本在服务器上而不是客户端运行,ASP所使用的脚本语言都在服务端上运行。 另外因为asp需要使用组件,所以了解一点组件的知识(ADODB也是组件) 弱类型造成潜在的出错可能:尽管弱数据类型的编程语言使用起来回方便一些,但相对于它所造成的出错几率是远远得不偿失的。
页:
[1]