Java Program to Extract a Image From a PDF Last Updated : 17 Nov, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Program to extract an image from a PDF using Java. The external jar file is required to import in the program. Below is the implementation for the same. Algorithm: Extracting image using the APACHE PDF Box module.Load the existing PDF document using file io.Creating an object of PDFRenderer class.Rendering an image from the PDF document using the BufferedImage class.Writing the extracted image to the new file.Close the document.Note: External files are required to download for performing the operation. For more documentation of the module used to refer to this. Implementation: Java // Extracting Images from a PDF using java import java.io.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.PDFRenderer; class GFG { public static void main(String[] args) throws Exception { // Existing PDF Document // to be Loaded using file io File newFile = new File("C:/Documents/GeeksforGeeks.pdf"); PDDocument pdfDocument = PDDocument.load(newFile); // PDFRenderer class to be Instantiated // i.e. creating it's object PDFRenderer pdfRenderer = new PDFRenderer(pdfDocument); // Rendering an image // from the PDF document // using BufferedImage class BufferedImage img = pdfRenderer.renderImage(0); // Writing the extracted // image to a new file ImageIO.write( img, "JPEG", new File("C:/Documents/GeeksforGeeks.png")); System.out.println( "Image has been extracted successfully"); // Closing the PDF document pdfDocument.close(); } } PDF before execution: Existing PDF Document which containing the image which is to be extracted Image after extraction: Extracted Image from the PDF document Comment More infoAdvertise with us Next Article Java Program to Extract Content from a TXT document S shivamraj74 Follow Improve Article Tags : Java Technical Scripter Java Programs Technical Scripter 2020 Practice Tags : Java Similar Reads Java Program to Extract Content from a PDF Java class< file using the Apache Tika< library is used. Â For document type detection and content extraction from various file formats, it uses various document parsers and document type detection techniques to detect and extract data. It provides a single generic API for parsing different fil 3 min read Java Program to Extract Content from a TXT document Java class< file using the Apache Tika library is used. Â For document type detection and content extraction from various file formats, it uses various document parsers and document type detection techniques to detect and extract data. It provides a single generic API for parsing different file fo 3 min read Java Program to Convert Byte Array to Image A byte array is the array of bytes that is used to store the collection of binary data. For example, the byte array of an image stores the information of every pixel of the image. In the byte array, we can store the content of any file in binary format. We can initialize the byte array with the byte 3 min read Java Program to Copy and Paste an image in OpenCV OpenCV is a Machine Learning and open-source computer vision software library, the main purpose for which it was developed is to enable a common medium to increase the use of machine perception in commercial businesses and accelerate the development of computer vision applications, it is a smooth an 3 min read Java Program to Tile a Page Content in a PDF In order to tile the pages, we are going to use the iText open-source library here because iText is a world-leading F/OSS PDF library. For Tiling a page content in a PDF, we need some classes iText library. The following are the components used in creating Tiling page content. PdfReader class which 3 min read Java Program to Convert PNG Images to JPEG PNG and JPG formats are used for image illustrations. Both the formats are used to provide good compatibilities with certain types of images like PNG works better with line drawings and icon graphics whereas JPG works well with photographs. However, both are interconvertible with respect to each oth 4 min read Like