0
我想创建多个pdf并将它们保存到一个目录。我有一个基于Appid的查询。对于每个appid,我需要在该位置创建PDF和存储。我可以为一个appid创建pdf。当我尝试为多个appid创建pdf时,数据将被添加到当前的pdf中。以下是我的代码。请告知这里发生了什么问题。在Coldfusion中创建多个pdf到一个目录
<cfquery name="getdetails" datasource="#CSTTDB#" username="#CSTTUSR#" password="#CSTTPWD#">
select a.motsid,B.APP,B.ITCONTACT,B.STD,B.ED,B.DIRECTOR,a.tool,a.upddate,a.EAQUESTION from bnsit.TBLEAMGMT a,scott.tblaccessmgmt b
where A.MOTSID = b.motsid
and a.motsid = '16'
and a.recid = '28'
and a.EAQUESTION = 'Yes'
</cfquery>
<cfif getdetails.recordcount gt 0>
<cfloop query="getdetails">
<cfdocument
format="pdf"
srcfile="\\wiwauk4colddw11.itservices.sbc.com\ITUPCOMP\pdf\"
filename="#getdetails.motsid#_#dateformat(upddate,"mmddyy")#_eareport.pdf"
overwrite="yes">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Emergency Access BNSIT - #getdetails.motsid#</title>
</head>
<style type="text/css" media="print">
td{
width=50%;
}
.tpx td{
border: solid 1px black;
}
</style>
<body>
<img src="email_header_plain.jpg" align="center" border= "0" alt="Header">
<p align="center">
<font size="+2" color="navy"> <strong>EMERGENCY ACCESS BNSIT</strong></font>
</p>
<br>
<cfoutput>
<cfset timenow = dateformat(now(),'mm/dd/yyyy')>
<TABLE id="mytable" align="center" class="tpx" bgcolor="azure" border="1" width="80%">
<tr>
<tr>
<th align="left"><strong>MOTSID:</strong></th>
<th align="left">#motsid#</th>
</tr>
<tr>
<th align="left"><strong>Application Name:</strong></th>
<th align="left">#app#</th>
</tr>
<tr>
<th align="left"><strong>IT Contact:</strong></th>
<th align="left">#itcontact#</th>
</tr>
<tr>
<th align="left"><strong>STD:</strong></th>
<th align="left">#STD#</th>
</tr>
<tr>
<th align="left"><strong>Director:</strong></th>
<th align="left">#director#</th>
</tr>
<tr>
<th align="left"><strong>ED:</strong></th>
<th align="left">#ED#</th>
</tr>
<tr>
<th align="left"><strong>Access Provisioning Tool:</strong></th>
<th align="left"> </th>
</tr>
<tr>
<th align="left"><strong>Emergency Access Tool:</strong></th>
<th align="left">#tool#</th>
</tr>
<tr>
<th align="left"><strong>Confirmation Received Date:</strong></th>
<th align="left">#dateformat(upddate,"mm/dd/yyyy")#</th>
</tr>
</table>
</cfoutput>
</body>
</html>
</cfdocument>
</cfloop>
<cffile action="COPY" source="\\wiwauk4colddw11.itservices.sbc.com\ITUPCOMP\pdf\#getdetails.motsid#_#dateformat(upddate,"mmddyy")#_eareport.pdf" destination="\\135.16.235.36\devcompliance\pdfreports\">
</cfif>
编辑:我更新了上面的代码,我试图将创建的PDF文件从一个位置复制到另一个服务器。使用给定的命名约定,PDF文件正在源文件夹中创建。
但我即将在cffile副本获得低于错误。请有什么想法?
非常感谢!最初我像你说的那样将cfloop移出cfdocument,但没有移动结束标签!!!!现在我做了,它再次感谢! – user747291