XSL-FO:带有互联网图像的外部图形

XSL-FO: external-graphic with intternet image

我们正在使用 Apache FOP 从 XML 文件生成 PDF。 XML 可以包含指向 facebook 个人资料图像的 link,但该路径实际上是一个重定向。

以下不起作用,它使用我们在 XML 文件中的路径:

<fo:external-graphic src="url('http://graph.facebook.com/<some id nbs>/picture"') />

以下作品:

<fo:external-graphic src="url('https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xap1/v/t1.0-1/p50x50/<some id>_n.jpg?oh=<some id>"') />

但是,不可能对每个真实的 URI 进行硬编码。 如何强制 FO 跟随 link? 否则,也许有办法从第一个 URI 检索图像?

感谢您的回答。 XSL-FO 真的很痛苦。

您应该在您的应用程序中调用图像 url https://graph.facebook.com/<some id nbs>/picture?redirect=false,然后提取结果 JSON 的 url 属性 的内容。

发现问题:

  • 使用 src="url('http://...')" 无效
  • 直接使用 url 即可 src="http://..."

但是,仍然不适用于 Facebook 图片。在 Twitter、Instagram 上运行良好...