Example usage for com.itextpdf.text Jpeg Jpeg

List of usage examples for com.itextpdf.text Jpeg Jpeg

Introduction

In this page you can find the example usage for com.itextpdf.text Jpeg Jpeg.

Prototype


public Jpeg(byte[] img) throws BadElementException, IOException 

Source Link

Document

Constructs a Jpeg-object from memory.

Usage

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

License:Open Source License

/**
 * This method is very specific to JPG images of CVIs.  Assumes them to be letter sized
 * and landscape orientation.  Other sizes will be scaled to fit.
 * @param jpgBytes byte[] with the contents of a jpg file.
 * @return//from   w w  w  . java 2  s.  com
 */
public static byte[] jpgToPdfBytes(byte jpgBytes[]) {
    try {
        Image jpgImage = new Jpeg(jpgBytes);
        return imageToPdfBytes(jpgImage);
    } catch (IOException e) {
        logger.error(e);
    } catch (BadElementException e) {
        logger.error(e);
    }
    return null;
}