Posted By:
Choi_Chandima
Posted On:
Wednesday, October 5, 2011 05:53 AM
I'm in a process of inserting images(png,tiff,jpg) to an existing pdf file. 1) i want to preserve the content of the original page. 2) want to add an image to a given X Y cooardiantes. I have managed to insert an image to a pdf file but every time i rune the code the page is re written. please help me this regards thanks. static Document document=new Document(); static FileOutputStream f1; static FileOutputStream createOpStream()throws Exception { f1=new FileOutputStream("C:\Documents and Settings\Administrator\My Documents\My Pictures\robin\imagesPDF.pdf" ); return f1; } publi
More>>
I'm in a process of inserting images(png,tiff,jpg) to an existing pdf file.
1) i want to preserve the content of the original page.
2) want to add an image to a given X Y cooardiantes.
I have managed to insert an image to a pdf file but every time i rune the code the page is re written. please help me this regards thanks.
static Document document=new Document();
static FileOutputStream f1;
static FileOutputStream createOpStream()throws Exception
{
f1=new FileOutputStream("C:\Documents and Settings\Administrator\My Documents\My Pictures\robin\imagesPDF.pdf" );
return f1;
}
public static void main(String[] args)throws Exception {
PdfWriter.getInstance(document,createOpStream() );
document.open();
Image image = Image.getInstance ("C:\Documents and Settings\Administrator\My Documents\My Pictures\robin\robinbig.jpg" );
image.setAbsolutePosition(0,100);
document.add(image);
document.close();
<<Less