How can I convert a GIF to XOD/PDF using Java on Linux?

Skip to first unread message


Jun 11, 2015, 9:54:51 PM6/11/15

I want to load a GIF and convert it to XOD/PDF with the Convert interface, on linux.  Also, I don't want to touch the file system, and I want everything done in a "streaming" way to keep any one image from spiking memory usage.  Also, I don't want to use anything with complex licensing (like third party libraries).  But I've found that the Linux PDFNet doesn't support loading up a GIF.  Can you help?


You would simply need to first convert the GIF to PNG using the ImageIO library built into Java.  The following shows how to do so using file paths:

Since you will likely want to stream files instead of saving to disk, you can use the equivalent function for streams:

Note that you would need to convert your input stream to a RenderedImage, which you can do by converting it to a BufferedImage (an implementation of RenderedImage):

Reply all
Reply to author
0 new messages