|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全CreatingaPDFwithASP
ByTyButton
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是怎么工作的。 |
|