public class PDFParser extends AbstractParser
This parser can process also encrypted PDF documents if the required
password is given as a part of the input metadata associated with a
document. If no password is given, then this parser will try decrypting
the document using the empty password that's often used with PDFs. If
the PDF contains any embedded documents (for example as part of a PDF
package) then this parser will use the EmbeddedDocumentExtractor
to handle them.
Modifier and Type | Field and Description |
---|---|
static String |
PASSWORD
Deprecated.
Supply a
PasswordProvider on the ParseContext instead |
Constructor and Description |
---|
PDFParser() |
Modifier and Type | Method and Description |
---|---|
boolean |
getEnableAutoSpace()
Deprecated.
|
boolean |
getExtractAnnotationText()
Deprecated.
|
PDFParserConfig |
getPDFParserConfig() |
boolean |
getSortByPosition()
Deprecated.
|
Set<MediaType> |
getSupportedTypes(ParseContext context)
Returns the set of media types supported by this parser when used
with the given parse context.
|
boolean |
getSuppressDuplicateOverlappingText()
Deprecated.
|
boolean |
getUseNonSequentialParser()
Deprecated.
|
void |
parse(InputStream stream,
ContentHandler handler,
Metadata metadata,
ParseContext context)
Parses a document stream into a sequence of XHTML SAX events.
|
void |
setEnableAutoSpace(boolean v)
Deprecated.
|
void |
setExtractAnnotationText(boolean v)
Deprecated.
|
void |
setPDFParserConfig(PDFParserConfig config) |
void |
setSortByPosition(boolean v)
Deprecated.
|
void |
setSuppressDuplicateOverlappingText(boolean v)
Deprecated.
|
void |
setUseNonSequentialParser(boolean v)
Deprecated.
|
parse
public static final String PASSWORD
public Set<MediaType> getSupportedTypes(ParseContext context)
Parser
context
- parse contextpublic void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException
Parser
The given document stream is consumed but not closed by this method. The responsibility to close the stream remains on the caller.
Information about the parsing context can be passed in the context parameter. See the parser implementations for the kinds of context information they expect.
stream
- the document stream (input)handler
- handler for the XHTML SAX events (output)metadata
- document metadata (input and output)context
- parse contextIOException
- if the document stream could not be readSAXException
- if the SAX events could not be processedTikaException
- if the document could not be parsedpublic void setPDFParserConfig(PDFParserConfig config)
public PDFParserConfig getPDFParserConfig()
public void setUseNonSequentialParser(boolean v)
setPDFParserConfig(PDFParserConfig)
public boolean getUseNonSequentialParser()
getPDFParserConfig()
setUseNonSequentialParser(boolean)
public void setEnableAutoSpace(boolean v)
setPDFParserConfig(PDFParserConfig)
public boolean getEnableAutoSpace()
getPDFParserConfig()
#setEnableAutoSpace.
public void setExtractAnnotationText(boolean v)
setPDFParserConfig(PDFParserConfig)
public boolean getExtractAnnotationText()
getPDFParserConfig()
public void setSuppressDuplicateOverlappingText(boolean v)
setPDFParserConfig(PDFParserConfig)
public boolean getSuppressDuplicateOverlappingText()
getPDFParserConfig()
#setSuppressDuplicateOverlappingText.
public void setSortByPosition(boolean v)
setPDFParserConfig(PDFParserConfig)
public boolean getSortByPosition()
getPDFParserConfig()
#setSortByPosition.
Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.