我正在尝试用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,有什么建议吗?
发布于 2014-04-09 03:32:08
这是一个CF8和CF9错误。我不确定此错误是否已通过CF9.1修复
http://blog.dkferguson.com/index.cfm/2008/1/11/CFDocument--pdf-generation-broke-after-CF8-upgrade
发布于 2014-05-14 13:19:48
我发现有时当CFDOCUMENT中断时,发现潜在问题的最简单方法是使用CFSAVECONTENT生成HTML,然后将完成并展开的HTML传递给CFDOCUMENT以呈现它。这样,如果您在HTML生成过程中遇到错误,错误本身将是显而易见的。
这还可以最大限度地缩短文档呈现的时间,除非您使用的是CF Enterprise,否则文档呈现是单线程的。
发布于 2020-12-11 02:42:08
确保为每个文本元素指定字体。
https://stackoverflow.com/questions/22945698
复制相似问题