Example usage for com.itextpdf.text.pdf.codec GifImage getImage

List of usage examples for com.itextpdf.text.pdf.codec GifImage getImage

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf.codec GifImage getImage.

Prototype

public Image getImage(int frame) 

Source Link

Document

Gets the image from a frame.

Usage

From source file:com.pdf.GetPdf.java

public static void addGif(Document document, String path) throws IOException, DocumentException {
    GifImage img = new GifImage(path);
    int n = img.getFrameCount();
    for (int i = 1; i <= n; i++) {
        document.add(img.getImage(i));
    }//  w  w  w  . j  ava 2s. c  om
}

From source file:edu.clemson.lph.pdfgen.MergePDF.java

License:Open Source License

/**
 * This method is very specific to GIF images of CVIs.  Assumes them to be letter sized
 * and landscape orientation.  Other sizes will be scaled to fit.
 * @param bmpBytes byte[] with the contents of a png file.
 * @return/* w  ww.  ja  va  2  s.  c o  m*/
 */
public static byte[] gifToPdfBytes(byte gifBytes[]) {
    try {
        com.itextpdf.text.pdf.codec.GifImage gif = new com.itextpdf.text.pdf.codec.GifImage(gifBytes);
        Image gifImage = gif.getImage(1);
        return imageToPdfBytes(gifImage);
    } catch (IOException e) {
        logger.error(e);
    }
    return null;
}