org.apache.pdfbox.util
Class PDFImageWriter

java.lang.Object
  extended by org.apache.pdfbox.util.PDFStreamEngine
      extended by org.apache.pdfbox.util.PDFImageWriter

public class PDFImageWriter
extends PDFStreamEngine

This class will take a PDF document and strip out all of the text and ignore the formatting and such. Please note; it is up to clients of this class to verify that a specific user has the correct permissions to extract text from the PDF document.

Patterned after PDFTextStripper.

Version:
$Revision: 1.1 $
Author:
Daniel Wilson

Constructor Summary
PDFImageWriter()
          Instantiate a new PDFImageWriter object.
PDFImageWriter(Properties props)
          Instantiate a new PDFImageWriter object.
 
Method Summary
 boolean writeImage(PDDocument document, String imageType, String password, int startPage, int endPage, String outputPrefix)
          Converts a given page range of a PDF document to bitmap images.
 boolean writeImage(PDDocument document, String imageFormat, String password, int startPage, int endPage, String outputPrefix, int imageType, int resolution)
          Converts a given page range of a PDF document to bitmap images.
 
Methods inherited from class org.apache.pdfbox.util.PDFStreamEngine
getColorSpaces, getCurrentPage, getFonts, getGraphicsStack, getGraphicsState, getGraphicsStates, getResources, getTextLineMatrix, getTextMatrix, getTotalCharCnt, getValidCharCnt, getXObjects, inspectFontEncoding, processEncodedText, processOperator, processOperator, processStream, processSubStream, processTextPosition, registerOperatorProcessor, resetEngine, setColorSpaces, setFonts, setGraphicsStack, setGraphicsState, setGraphicsStates, setTextLineMatrix, setTextMatrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFImageWriter

public PDFImageWriter()
Instantiate a new PDFImageWriter object.


PDFImageWriter

public PDFImageWriter(Properties props)
               throws IOException
Instantiate a new PDFImageWriter object. Loading all of the operator mappings from the properties object that is passed in.

Parameters:
props - The properties containing the mapping of operators to PDFOperator classes.
Throws:
IOException - If there is an error reading the properties.
Method Detail

writeImage

public boolean writeImage(PDDocument document,
                          String imageType,
                          String password,
                          int startPage,
                          int endPage,
                          String outputPrefix)
                   throws IOException
Converts a given page range of a PDF document to bitmap images.

Parameters:
document - the PDF document
imageType - the target format (ex. "png")
password - the password (needed if the PDF is encrypted)
startPage - the start page (1 is the first page)
endPage - the end page (set to Integer.MAX_VALUE for all pages)
outputPrefix - used to construct the filename for the individual images
Returns:
true if the images were produced, false if there was an error
Throws:
IOException - if an I/O error occurs

writeImage

public boolean writeImage(PDDocument document,
                          String imageFormat,
                          String password,
                          int startPage,
                          int endPage,
                          String outputPrefix,
                          int imageType,
                          int resolution)
                   throws IOException
Converts a given page range of a PDF document to bitmap images.

Parameters:
document - the PDF document
imageFormat - the target format (ex. "png")
password - the password (needed if the PDF is encrypted)
startPage - the start page (1 is the first page)
endPage - the end page (set to Integer.MAX_VALUE for all pages)
outputPrefix - used to construct the filename for the individual images
imageType - the image type (see BufferedImage.TYPE_*)
resolution - the resolution in dpi (dots per inch)
Returns:
true if the images were produced, false if there was an error
Throws:
IOException - if an I/O error occurs


Copyright © 2002-2010 The Apache Software Foundation. All Rights Reserved.