CFDocument:coldfusion.document.spi.DocumentExportException:java.lang.NullPointerException

时间:2014-04-08 18:48:03

标签: coldfusion coldfusion-9 cfdocument

我正在尝试使用cfdocument创建一个pdf,但ColdFusion一直在抛出异常,我无法找到解决此问题的方法。

这是我正在使用的代码:

<cfdocument format="pdf" filename="rep_report.pdf" overwrite="yes" name="rep_report">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Untitled Document</title>
  </head>

  <body>
      <style>
          <cfinclude template="stylesheets/bootstrap.min.css">
      </style>

      <cfinclude template="views/_reputationTable.cfm">  
  </body>
</html>
</cfdocument>

这是例外:

An exception occurred when performing document processing.
The cause of this exception was that: coldfusion.document.spi.DocumentExportException: java.lang.NullPointerException.

The error occurred in E:/sites/xAmplifier.com/admin/rep_report_template.cfm: line 43
Called from E:/sites/xAmplifier.com/admin/wheels/events/onrequest.cfm: line 1
Called from E:/sites/xAmplifier.com/admin/rep_report_template.cfm: line 43
Called from E:/sites/xAmplifier.com/admin/wheels/events/onrequest.cfm: line 1
41 :       </style>
42 :       
43 :       <cfinclude template="views/_reputationTable.cfm">  
44 :   </body>
45 : </html>

似乎我的问题是我试图包含模板的部分,但遗憾的是我无法解决这个问题。

有关如何保留所包含模板并使用cfdocument的任何建议?

3 个答案:

答案 0 :(得分:1)

这是一个CF8和CF9错误。我不确定这个错误是用CF9.1修复的

http://blog.dkferguson.com/index.cfm/2008/1/11/CFDocument--pdf-generation-broke-after-CF8-upgrade

答案 1 :(得分:1)

我发现CFDOCUMENT有时会发现找到底层问题的最简单方法是使用CFSAVECONTENT生成HTML,然后将完成和扩展的HTML传递给CFDOCUMENT进行渲染。这样,如果你在HTML生成中遇到错误,错误本身就会很明显。

这也最大限度地减少了文档呈现的时间,除非您使用的是CF Enterprise,否则它是单线程的。

答案 2 :(得分:0)

确保为每个文本元素指定一种字体。

相关问题