Getting RawData From Image File and Manipulation : Image Manipulation « PDF RTF « Java






Getting RawData From Image File and Manipulation

import java.io.FileOutputStream;
import java.io.RandomAccessFile;

import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.pdf.PdfWriter;

public class RawDataFromImageFileAndManipulationPDF {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("RawDataFromImageFileAndManipulationPDF.pdf"));
      document.open();
      
      RandomAccessFile rf = new RandomAccessFile("logo.png", "r");
      int size = (int) rf.length();
      byte imext[] = new byte[size];
      rf.readFully(imext);
      rf.close();
      
      for(int i=0;i<imext.length;i++){
        imext[i]= (byte)(imext[i]+3);
      }

      Image img1 = Image.getInstance(100, 100, 3, 8, imext);
      img1.setAbsolutePosition(200, 200);
      document.add(img1);
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category

1.Getting RawData From Image FileGetting RawData From Image File