【问题标题】:Coldfusion cfhtmltopdf tag not displaying bmp imagesColdfusion cfhtmltopdf 标签不显示 bmp 图像
【发布时间】:2016-12-14 15:28:28
【问题描述】:

我正在使用<cfhtmltopdf> 标签将 .cfm 文件作为模板拉入并创建 PDF。当我使用 jpg 作为图像格式时,一切正常。但如果图像是 BMP - 出于某种原因,它将无法工作。 在模板文件中,我使用没有过滤器的<cfdirectory> 标记来拉入图像。

<cfdirectory directory="E:\xxx\images\#image_ID#\" name="myDir" type="file" sort="datelastmodified">

然后我使用&lt;cfloop&gt; 来显示目录中的图像...

 <cfloop query="myDir">
  <cfif right(myDirMain.name,4) is ".bmp" >

        <img src="#request.root#images/#images_ID#/#myDir.name#" border="0" width="230px" style="margin-bottom:15px;"  />
      </cfif>

这对 jpg 很有用,但在尝试使用 bmp 图像时 - 就不好了。

有谁知道 bmp 图像是否存在问题或仅适用于 jpg 图像的原因?

【问题讨论】:

  • 您所说的“但是在尝试使用 bmp 图像时 - 不好”是什么意思?代码是否跳过了&lt;img&gt; 标签?图像在浏览器中看起来不是“好”吗?是否抛出错误?
  • 您好,我在应该有图像的地方创建的 PDF 中缺少一个图像图标。谢谢
  • 您能附上您的&lt;cfhtmltopdf ... 代码吗?
  • 当然,给你...&lt;cfset temppath="#uploadPath#pdf"&gt; &lt;cfhtmltopdf pagetype="a4" destination="#temppath#/#id_refid#.pdf" overwrite="Yes" orientation = "portrait"&gt; &lt;cfinclude template="../includes/pdf_a4_template.cfm"&gt; &lt;/cfhtmltopdf&gt;
  • 您是否提交了错误报告(或找到现有的)?如果是这样,请继续将其添加到您的答案中,以便更明显,其他人可以对其进行投票。

标签: coldfusion bmp coldfusion-11


【解决方案1】:

系统中似乎存在阻止 PDF 使用 BMP 图像的错误。一个解决方案是在创建 PDF 之前使用 &lt;cfimage&gt; 标签转换它们 - 它的解决方法是有效的,即使它使用更多的服务器资源。

【讨论】:

    猜你喜欢
    • 2021-11-30
    • 1970-01-01
    • 2014-09-29
    • 1970-01-01
    • 2018-04-23
    • 1970-01-01
    • 2014-10-10
    • 2019-02-22
    相关资源
    最近更新 更多