public class PDFParser
extends org.apache.tika.parser.AbstractParser
implements org.apache.tika.config.Initializable
EmbeddedDocumentExtractor
to handle them.
As of Tika 1.6, it is possible to extract inline images with
the EmbeddedDocumentExtractor as if they were regular
attachments. By default, this feature is turned off because of
the potentially enormous number and size of inline images. To
turn this feature on, see
PDFParserConfig.setExtractInlineImages(boolean).
Please note that tables are not stored as entities within PDFs. It
takes significant computation to identify and then correctly extract
tables from PDFs. As of this writing, the PDFParser extracts
text within tables, but it does not compute table cell boundaries or
table row boundaries. Please see
tabula for one project that
tries to maintain the structure of tables represented in PDFs.| 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 |
|---|---|
void |
checkInitialization(org.apache.tika.config.InitializableProblemHandler handler) |
protected org.apache.pdfbox.pdmodel.PDDocument |
getPDDocument(InputStream inputStream,
String password,
org.apache.pdfbox.io.MemoryUsageSetting memoryUsageSetting,
org.apache.tika.metadata.Metadata metadata,
org.apache.tika.parser.ParseContext parseContext) |
protected org.apache.pdfbox.pdmodel.PDDocument |
getPDDocument(Path path,
String password,
org.apache.pdfbox.io.MemoryUsageSetting memoryUsageSetting,
org.apache.tika.metadata.Metadata metadata,
org.apache.tika.parser.ParseContext parseContext) |
PDFParserConfig |
getPDFParserConfig() |
Set<org.apache.tika.mime.MediaType> |
getSupportedTypes(org.apache.tika.parser.ParseContext context) |
void |
initialize(Map<String,org.apache.tika.config.Param> params)
This is a no-op.
|
boolean |
isEnableAutoSpace() |
boolean |
isExtractAnnotationText()
Deprecated.
|
boolean |
isSortByPosition()
Deprecated.
|
boolean |
isSuppressDuplicateOverlappingText()
Deprecated.
|
void |
parse(InputStream stream,
ContentHandler handler,
org.apache.tika.metadata.Metadata metadata,
org.apache.tika.parser.ParseContext context) |
void |
setDropThreshold(float dropThreshold) |
void |
setEnableAutoSpace(boolean v)
If true (the default), the parser should estimate
where spaces should be inserted between words.
|
void |
setExtractAnnotationText(boolean v)
If true (the default), text in annotations will be
extracted.
|
void |
setMaxMainMemoryBytes(long maxMainMemoryBytes) |
void |
setOcrImageType(String imageType) |
void |
setOcrRenderingStrategy(String ocrRenderingStrategy) |
void |
setOcrStrategy(String ocrStrategyString) |
void |
setOcrStrategyAuto(String ocrStrategyAuto) |
void |
setPDFParserConfig(PDFParserConfig config) |
void |
setSortByPosition(boolean v)
If true, sort text tokens by their x/y position
before extracting text.
|
void |
setSuppressDuplicateOverlappingText(boolean v)
If true, the parser should try to remove duplicated
text over the same region.
|
public static final String PASSWORD
PasswordProvider on the ParseContext insteadpublic Set<org.apache.tika.mime.MediaType> getSupportedTypes(org.apache.tika.parser.ParseContext context)
getSupportedTypes in interface org.apache.tika.parser.Parserpublic void parse(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context) throws IOException, SAXException, org.apache.tika.exception.TikaException
parse in interface org.apache.tika.parser.ParserIOExceptionSAXExceptionorg.apache.tika.exception.TikaExceptionprotected org.apache.pdfbox.pdmodel.PDDocument getPDDocument(InputStream inputStream, String password, org.apache.pdfbox.io.MemoryUsageSetting memoryUsageSetting, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext parseContext) throws IOException
IOExceptionprotected org.apache.pdfbox.pdmodel.PDDocument getPDDocument(Path path, String password, org.apache.pdfbox.io.MemoryUsageSetting memoryUsageSetting, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext parseContext) throws IOException
IOExceptionpublic PDFParserConfig getPDFParserConfig()
public void setPDFParserConfig(PDFParserConfig config)
public boolean isEnableAutoSpace()
setEnableAutoSpace(boolean)@Field public void setEnableAutoSpace(boolean v)
public boolean isExtractAnnotationText()
getPDFParserConfig()@Field public void setExtractAnnotationText(boolean v)
public boolean isSuppressDuplicateOverlappingText()
getPDFParserConfig()@Field public void setSuppressDuplicateOverlappingText(boolean v)
public boolean isSortByPosition()
getPDFParserConfig()setSortByPosition(boolean)@Field public void setSortByPosition(boolean v)
@Field public void setOcrStrategy(String ocrStrategyString)
@Field public void setOcrStrategyAuto(String ocrStrategyAuto)
@Field public void setOcrRenderingStrategy(String ocrRenderingStrategy)
@Field public void setOcrImageType(String imageType)
@Field public void setDropThreshold(float dropThreshold)
@Field public void setMaxMainMemoryBytes(long maxMainMemoryBytes)
public void initialize(Map<String,org.apache.tika.config.Param> params) throws org.apache.tika.exception.TikaConfigException
initialize in interface org.apache.tika.config.Initializableparams - params to use for initializationorg.apache.tika.exception.TikaConfigExceptionpublic void checkInitialization(org.apache.tika.config.InitializableProblemHandler handler)
throws org.apache.tika.exception.TikaConfigException
checkInitialization in interface org.apache.tika.config.Initializableorg.apache.tika.exception.TikaConfigExceptionCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.