Java tutorial
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(); } }