Image ExtractionThe Image Extraction example will extract all image content from a PDF page and save the images to disk. The image data is converted to RGB and the images is saved at the original size as defined by the image object reference. For converting PDF pages to image see http://www.icesoft.org/wiki/display/PDF/Page+Capture Page currentPage = document.getPageTree().getPage(pageNumber); int count = 0; RenderedImage rendImage; List<Image> images = currentPage.getImages(); for (Image image : images) { count++; if (image != null) { rendImage = (BufferedImage) image; System.out.println("Capture page " + pageNumber + " image " + count); File file = new File("imageCapture_" + pageNumber + "_" + count + ".png"); ImageIO.write(rendImage, "png", file); image.flush(); } } // clears most resource. images.clear(); The source-code for this example is located at: A primer on using Maven or Gradle build commands can be found here (Maven) and here (Gradle) |
Image Extraction
© Copyright 2017 ICEsoft Technologies Canada Corp.