0

I am working with a bytearray which contains multiple images. How can I retrieve the images from the bytearray in Java.

  PDDocument document = null;
  int pageCounter = 0;
  BufferedImage bim = null;
  document = PDDocument.load(pdfBytes);
  PDFRenderer pdfRenderer = new PDFRenderer(document);
  bim = pdfRenderer.renderImageWithDPI(pageCounter, 300, ImageType.RGB);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  ImageIO.write(rotate(bim), imageFormat, bos);
  output = bos.toByteArray();

rotate is a method to rotate the image. I want to rotate only one Image. The other I do not want to rotate. Also I want to output it again in Bytes

Rey
  • 13
  • 6
  • In order to do that you have to know how the bytearray was created from the image**s** (or guess somehow) –  Apr 12 '17 at 15:15
  • Some possible solution: [extract all images](http://stackoverflow.com/questions/8705163/extract-images-from-pdf-using-pdfbox), then rotate what you want to rotate. –  Apr 12 '17 at 15:17

0 Answers0