CFDocument:coldfusion.document.spi.DocumentExportException:java.lang.NullPointerException [英] CFDocument: coldfusion.document.spi.DocumentExportException: java.lang.NullPointerException

查看:258
本文介绍了CFDocument:coldfusion.document.spi.DocumentExportException:java.lang.NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to create a pdf using cfdocument but ColdFusion keeps throwing an exception and I can't find a way to work around this.

这是我正在使用的代码:

This is the code that I am using:

<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>

似乎我的问题是我试图包括模板的部分,但不幸的是我没有对此没有办法。

It seems that my issue is the part where I am trying to include a template but unfortunately I don't have a way around this.

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

Any suggestions on how I can keep the included template and use cfdocument?

推荐答案

我有时发现,当CFDOCUMENT中断时,找到潜在问题的最简单方法是使用CFSAVECONTENT生成HTML,然后将完成并扩展的HTML传递给CFDOCUMENT进行渲染。这样,如果您确实在HTML生成中遇到错误,则错误本身将很明显。

I find sometimes when CFDOCUMENT breaks that the easiest path to finding the underlying problem is to use CFSAVECONTENT to generate the HTML, then pass the completed and expanded HTML to CFDOCUMENT to render it. That way, if you do hit an error in HTML generation, the error itself will be obvious.

这还可以最大程度地缩短文档渲染的时间,除非您使用CF Enterprise,否则它是单线程的。

This also minimises the time the document rendering is taking place, which is single-threaded unless you are using CF Enterprise.

这篇关于CFDocument:coldfusion.document.spi.DocumentExportException:java.lang.NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆