FOP with IKVM: No Images

时光怂恿深爱的人放手 提交于 2019-12-25 04:07:20

问题


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.

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

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


回答1:


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

This results in an images.pdf that looks good.

If you have a repro scenario for this, feel free to mail it to me (jeroen@frijters.net) and I'll have a look.

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/



来源:https://stackoverflow.com/questions/5016140/fop-with-ikvm-no-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!