image - 无法使用 cfdocument/cfcontent 在 pdf 中包含图像

标签 image coldfusion pdf-generation cfdocument

我正在使用 cfcontent 从网络根目录外部流式传输图像。虽然在浏览器中直接调用各个页面时图像可以正确显示,但图像在生成的 pdf 中显示一个红色 X。在导出页面上:

<cfsavecontent variable = "gridCode">
    <cfinclude template="pathToGeneratedPage.cfm" >     
</cfsavecontent>
<cfdocument format="pdf" filename="#filename#" overwrite="yes" localUrl="yes">
    <cfdocumentsection >
        <cfoutput>#gridCode#</cfoutput>     
    </cfdocumentsection>
</cfdocument>

在需要生成内容的页面上:

<img src="pathToDisplayPhoto.cfm?image=#someImage#" />

在displayPhoto.cfm页面上:

<cfcontent type="image/*" file="#pathToUploadFolderOutsideWebRoot##url.image#" deleteFile = "No">

我包含了 cfdocument 属性 localUrl="yes"因为默认值(no)不起作用。明确设置为“否”也不起作用。

有什么建议吗?

最佳答案

我正在保存创建的 pdf,发现 localUrl="yes"(或 =true)失败。

<img src="file:\\\#replace(getCurrentTemplatePath(),"my.cfm")#images\my.png">

为任何在桶底寻找想法的人工作。 getCurrentTemplatePath() 获取文件名和路径,所以我必须删除它(因此替换(...,“my.cfm”)。我也尝试过 ExpandPath(“.”),但也失败了。

关于image - 无法使用 cfdocument/cfcontent 在 pdf 中包含图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11969692/

相关文章:

cocoa - 在 NSImageView 中绘制 NSBitmapImageRep

jquery - 如何使用 Dropzone.js 在预览中使用实际图像而不是缩略图

javascript - 如何在 Canvas 上同时绘制图像和草图

coldfusion - 如何在 Coldfusion 中从 Active Directory 的根目录进行搜索

pdf - 为什么此墨迹注释显示曲线而不是直线?

java - 使用java PDFBox将源pdf的页面复制(或重复)到另一个pdf

java - 缓冲图像填充不起作用

coldfusion - GlassFish Server(开源)ColdFusion "requested resource is not available"错误

coldfusion - Jrun ColdFusion 服务间歇性无法启动

Python:从 .html 创建自动严格设计的多页 .pdf 报告