I seem to be unable to insert any images other than JPEGs into my PDF. Is this a known limitation or am I doing something wrong? Here's the code I use that does work for JPEGs:
byte imageBytes = getImage();
Image image = Image.get(new Buffer(imageBytes));
new Point2D.Double(xCoord, yCoord),
new Dimension(image.getWidth(), image.getHeight()));
But when I use GIFs or PNGs the image object is null after the Image.get() statement :(
Any workarounds for this?
there's no magic about non-JPEG images: no implemented codec == no support. PNG is a pending activity I haven't scheduled yet. GIF is not considered.
As a simple workaround you can obviously convert your images to JPEG before submitting to the library.
Thank you Stefano.
So does that mean only JPEG images are supported at the time?
The conversion to JPEG would have to happen on the fly, and without the user involvement. :(
Not sure how I'm going to mechanize that.
You could try using the DevIL library to do the conversion for you: http://openil.sourceforge.net/
I'm not sure if you're using the C# or the Java library but if you're using C# you could P/Invoke that library and the plus side is that it handles practically every image format you can imagine from the obscure to the very common.
No, the contingent absence of a codec due to pending development activities doesn't make any sense in considering (temporary) support to format conversion: at this stage, it's upon the user to fill the gap either pipelining an external converter or contributing code/money to speed up the project's evolution.
Log in to post a comment.