I am using PDFBox 1.8.13 and found link extract images from pdf using pdfbox for extracting all images in page. I want to modify the image and place the modified image where it was located. The code snippet :
Map<String,PDXObject> map = page.getResources().getXObjects();
for(String key : map.keySet())
{
byte[] b = map.get(key).getPDStream().getByteArray();
PDMetadata data =map.get(key).getMetadata();
if(b.length >=2 * 1024)
{
//get the image bytes and modify byte array as per required
//Place the modified image bytes into the location where
// the original image was (Please help with the code)
}
}
Please help.
Regards and Thanks
Kris