本文介绍了带 IKVM 的 FOP:无图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在 .NET 中成功编译并使用了带有 IKVM 0.44.5 的 FOP 1.0,但是我无法让它在生成的 PDF 中显示任何图像.

I've successfully compiled and used FOP 1.0 with IKVM 0.44.5 in .NET, however I can't get it to show any images in the resulting PDF.

当我在命令行中通过 ikvm 运行 FOP 时,我得到一个 java.io.EOFException.当我使用 java 转换同一个文件时,图像显示完美.

When I run FOP via ikvm in the command-line, I get a java.io.EOFException. When I transform the same file using java, the Images shows up perfectly.

java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.readUTF(Unknown Source)
    at java.lang.reflect.Method.invoke(Method.java:612)
    at org.apache.xmlgraphics.image.loader.util.ImageUtil$1.invoke(ImageUtil.java:246)
    at $Proxy0.readUTF(Unknown Source)
    at com.sun.imageio.plugins.png.PNGImageReader.parse_iTXt_chunk(PNGImageReader.java:469)
    at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:710)
    at com.sun.imageio.plugins.png.PNGImageReader.getImageMetadata(PNGImageReader.java:1543)
    at org.apache.xmlgraphics.image.loader.impl.imageio.PreloaderImageIO.preloadImage(PreloaderImageIO.java:71)
    at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:176)
    at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:128)
    at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:122)
    at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
Caused by: java.io.EOFException
    at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:346)
    at java.io.DataInputStream.readUTF(DataInputStream.java:607)
    at javax.imageio.stream.ImageInputStreamImpl.readUTF(ImageInputStreamImpl.java:332)
    ... 49 more

有没有人使用 FOP+IKVM 获取图像?任何帮助或解决方案的指针将不胜感激!

Has anyone gotten images to work using FOP+IKVM? Any help or pointers to a solution would be highly appreciated!

推荐答案

我对 FOP 了解不多,但一个简单的图片示例可以:

I don't know much about FOP, but a simple example with images works:

C:\j\fop-1.0>set JAVACMD=\ikvm-0.44.0.5\bin\ikvm.exe
C:\j\fop-1.0>fop -fo examples\fo\basic\images.fo -pdf images.pdf

这会生成一个看起来不错的 images.pdf.

This results in an images.pdf that looks good.

如果您对此有重现方案,请随时将其邮寄给我 ([email protected]),我会看看.

If you have a repro scenario for this, feel free to mail it to me ([email protected]) and I'll have a look.

更新:感谢导致问题的 .png.我用 0.44 重现了这个问题,但在当前的开发版本中它可以正常工作.最新的开发快照可在 http://weblog.ikvm.net/

Update: Thanks for the .png that caused the problem. I reproduced the problem with 0.44, but in the current development version it works correctly. The most recent development snapshot is available at http://weblog.ikvm.net/

这篇关于带 IKVM 的 FOP:无图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 13:22