【问题标题】:PDF generated using CFDocument with CFPDF Action="Header" does not print on Paper or preview使用带有 CFPDF Action=\"Header\" 的 CFDocument 生成的 PDF 不会在纸上打印或预览
【发布时间】:2022-07-04 23:02:47
【问题描述】:

我已经使用 cfdocument 生成了 pdf。使用 cfpdf=\"addHeader\" 添加标题。此页眉在纸上打印时不打印或在打印预览中显示。 这是代码

<cfsavecontent  variable=\"pdfHeaderText\">
    Daily Consumer Report
</cfsavecontent>

<cfdocument name=\"PDFVariable\" format=\"PDF\" orientation=\"portrait\" marginbottom=\"1\" marginleft=\"0.5\" marginright=\"0.5\" margintop=\"1\" overwrite=\"true\" >
    <cfdocumentsection name=\"Title\">
        <cfinclude template=\"MyReportData.cfm\">
    </cfdocumentsection>
</cfdocument>

<cfpdf action=\"addHeader\" name=\"pdfwithHeader\" source=\"PDFVariable\" align=\"left\"
    text=\"#pdfHeaderText#\" overwrite = \"yes\">
</cfpdf>

<cfheader name=\"Content-Disposition\" value=\"attachment; filename=DailyReport.pdf\" />
<cfcontent type=\"application/pdf\" file=\"#Variables.DESTINATION_DIR#/#PDFfilename#\" deletefile=\"yes\" />

任何帮助将非常感激。谢谢你。

  • 你试过cfdocumentitem吗?
  • 为什么不像 Dan 所说的那样使用 cfdocument 项目?难道你的来源也不需要变量周围的#?
  • 是的丹,我试过 cfdocumentitem。使用 type=\"header\" 生成 PDF。生成带有简单标题的简单 pdf 需要 2 个多小时。没有标题,它可以更快地正常工作。所以我使用了 <cfpdf action=\"addHeader\"。它通常更快地生成 pdf,但它不会在纸上打印标题。
  • 2小时??你在产生什么?哈哈

标签: printing coldfusion header cfdocument cfpdf


【解决方案1】:
   <cfdocument name="PDFVariable" format="PDF" orientation="portrait" marginbottom="1" marginleft="0.5" marginright="0.5" margintop="1" overwrite="true" >

     <cfdocumentitem type="header">
           <cfinclude template="HEADERDATA.cfm">
     </cfdocumentitem>

     <cfdocumentitem type="footer">
           <cfinclude template="FOOTERDATA.cfm">
     </cfdocumentitem> 

           --------
           YOU COULD ALSO JUST PULL IN A .CFM TEMPLATE WITH COLDFUSION/HTML/CSS
           <cfinclude template="HEADERDATA.cfm">
           --------

     <cfdocumentsection name="Title">
           <cfinclude template="MyReportData.cfm">
     </cfdocumentsection>

   </cfdocument>

【讨论】:

  • 嗨 Meria_the_Pearl,是的,我已经这样做了。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-12
  • 2017-12-19
  • 1970-01-01
  • 1970-01-01
  • 2016-01-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多