Wednesday, April 11, 2012

How to drag & drop an image over a PDF page in android?

Here is my idea/requirement .



I want to open a pdf document on android device and edit the last page of pdf document by adding an image (pdf & image both are stored @ sdcard) to it. And the image should be draggable. i.e, i should be able to drag & drop the image wherever i want on last page of pdf doc. And when i click on one button (i.e save) the image should be merged with pdf at where i dropped it. Is it possible to edit a pdf by adding an image in such a way that the image should be draggable? How can i achieve it ? Please share some links/views.



Here is my code to add the image on a pdf file (using itext library). How do i make the image draggable ?



  PdfReader pdfReader = new PdfReader(PDF_PATH);                     
//copy of input pdf file
PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileOutputStream(NEW_PDF_PATH));

Image im = Image.getInstance(MY_IMAGE_PATH);
int numOfPages = pdfReader.getNumberOfPages();

for(int index = 1; index <= numOfPages; index++)
{
if( index == numOfPages)
{
PdfContentByte content = pdfStamper.getUnderContent(index);
im.setAbsolutePosition(50f,50f);
content.addImage(im);
}
}
pdfStamper.close();


or Please provide me any link from which i can get help. Thanks in Advance
Need very Urgently..





No comments:

Post a Comment