3

我在 ColdFusion 上需要一些帮助我正在尝试创建封面,然后在审阅者旁边添加已批准的印章。但是,我可以在页面上添加图章,但不能在审阅者旁边。这是 ColdFusion 代码。

<cfset sourcefile = "E:\http\docs\psdr\sample.pdf">
<cfset destinationfile = "E:\http\docs\psdr\sample_output.pdf">

<cfset cur_event_date  =  DateFormat(now(), "mm/dd/yyyy")> 
<cfset cur_event_time =  TimeFormat(now(), "hh:mm tt")> 
<cfset reviewList = "Electrical Engineering Review, Mechanical Engineering Review
, Management Approval">

<cfdocument format="PDF" name="coverPage"> 
    <html> 
        <body> 
            <h1>Reviewers Approval</h1> 
            <table class="table" border="0" cellspacing="2" cellpadding="2">
                <thead>
                    <tr>
                        <th scope="col">Step</th>
                        <th scope="col">Action</th>
                        <th scope="col">Name</th>
                        <th scope="col">Date</th>
                        <th scope="col">Time</th>
                        <th scope="col">Comments</th>
                    </tr>
                </thead>
                <tbody>
                    <cfloop list="#reviewList#" index="reviewers">
                        <cfoutput>
                            <tr>
                                <td>#reviewers#</td>
                                <td></td>
                                <td></td>
                                <td>#cur_event_date#</td>
                                <td>#cur_event_time#</td>
                                <td></td>
                            </tr>
                        </cfoutput>
                        <br>
                    </cfloop>
                </tbody>
            </table>
        </body> 
    </html> 
</cfdocument>

<cfpdf action="addStamp" source="coverPage" overwrite="yes">
    <cfpdfparam pages="1" coordinates="397,532,519,564" iconname="Approved"/> 
</cfpdf>

<cfpdf action="addStamp" source="#sourcefile#" destination="#destinationfile#" overwrite="yes" >
    <cfpdfparam pages="1" coordinates="397,532,519,564" iconname="Approved" 
                note="on #dateTimeFormat(now(), 'yyyy/mm/dd HH:nn')#"/> 
</cfpdf>

<cfpdf action="merge" destination="#destinationfile#" overwrite="yes">
    <cfpdfparam source="coverPage"> 

    <cfpdfparam source="#destinationfile#"/> 
</cfpdf>

<h1>Add Stamp</h1> 

现在没有使用任何特定 HTML 的指南/要求,但由于这是一个封面页,我需要做的就是创建一个列表并在审阅者旁边添加标记。我们可以使用网格,表格任何格式都可以,无论如何都可以,例如从现有 PDF 中删除页面然后使用 cfdocument 创建。

4

1 回答 1

2

感谢您的建议。我通过在 td 元素中使用 img 来实现它。这里是代码。

<cfset sourcefile = "E:\http\docs\psdr\sample.pdf">
<cfset destinationfile = "E:\http\docs\psdr\sample_output.pdf">

<cfset cur_event_date  =  DateFormat(now(), "mm/dd/yyyy")> 
<cfset cur_event_time =  TimeFormat(now(), "hh:mm tt")> 
<cfset reviewList = "Electrical Engineering Review, Mechanical Engineering Review
, Management Approval">

<link rel="stylesheet" type="text/css" href="../util/reportdisplay.css"></link>

<cfdocument format="PDF" name="coverPage" localUrl = "yes"> 
    <html> 
        <body> 
            <h1>Reviewers Approval</h1> 
            <table class="table" border="0" cellspacing="2" cellpadding="2">
                <thead>
                    <tr>
                        <th scope="col">Step</th>
                        <th scope="col">Action</th>
                        <th scope="col">Name</th>
                        <th scope="col">Date</th>
                        <th scope="col">Time</th>
                        <th scope="col">Comments</th>
                    </tr>
                </thead>
                <tbody>
                    <cfloop list="#reviewList#" index="reviewers">
                        <cfoutput>
                            <tr>
                                <td>#reviewers#</td>
                                <td><img src="https://mesdev.intranet.cnb/e/images/approved_stamp.JPG" width="120" height="38"></td>
                                <td>Reviewed</td>
                                <td>#cur_event_date#</td>
                                <td>#cur_event_time#</td>
                                <td></td>
                            </tr>
                        </cfoutput>
                        <br>
                    </cfloop>
                </tbody>
            </table>
        </body> 
    </html> 
</cfdocument>


<cfpdf action="addStamp" source="#sourcefile#" destination="#destinationfile#" overwrite="yes" >
    <cfpdfparam pages="1" coordinates="397,532,519,564" iconname="Approved" 
                note="on #dateTimeFormat(now(), 'yyyy/mm/dd HH:nn')#"/> 
</cfpdf>

<cfpdf action="merge" destination="#destinationfile#" overwrite="yes">
    <cfpdfparam source="coverPage"> 

    <cfpdfparam source="#destinationfile#"/> 
</cfpdf>
于 2020-05-11T16:41:44.663 回答