【问题标题】:xsl:fo image displays as black box in only Google chromexsl:fo 图像仅在 Google chrome 中显示为黑框
【发布时间】:2015-03-22 08:39:05
【问题描述】:

我正在使用 xsl:fo 创建一个 pdf 文件,

现在我在 Google chrome 浏览器中遇到问题。

生成pdf文件时,pdf中的图片不显示。出现一个黑框而不是图像。

我有类型 try all content-type for xsl:fo external-graphic。

但我得到的是黑匣子而不是图像。

我只在谷歌浏览器中遇到这个问题,在其他浏览器中它工作正常。

这是代码,我用它来使用 xsl:fo 在 pdf 中显示图像

<fo:table-cell text-align="left" padding-left="30px" padding-bottom="10px" background-color="white">
              <fo:block>
                <fo:external-graphic content-width="100%" content-height="100%" content-type="content-type:image/jpg">
                  <xsl:attribute name="src">url(http://../images/barcode1.jpg)</xsl:attribute>
                </fo:external-graphic>
              </fo:block>
            </fo:table-cell>

【问题讨论】:

  • 可能是 .jpg 文件的问题。您是否尝试过:将图像放入 Word 文件中,另存为 PDF 并在 Chrome 中打开 PDF。如果这也导致出现黑框,您就知道问题出在 Chrome 中读取 PDF 的代码中。
  • 感谢@Hobbes 的回复,它不是.jpg 文件的问题,我尝试了所有不同的扩展图像,但它不起作用。

标签: asp.net google-chrome xslt-2.0 xsl-fo


【解决方案1】:

我们没有看到太多您的 XSLT 或 XSL-FO 代码,所以这只是一个猜测。试试

<fo:external-graphic content-width="100%" content-height="100%" content-type="content-type:image/jpg">
     <xsl:attribute name="src">
        <xsl:value-of select="http://../images/barcode1.jpg"/>
     </xsl:attribute>
</fo:external-graphic>

如果有任何变化,请告诉我。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-18
    • 2013-04-11
    • 2015-10-25
    • 2020-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-04
    相关资源
    最近更新 更多