Class PDFParser

java.lang.Object
org.apache.tika.parser.pdf.PDFParser
All Implemented Interfaces:
Serializable, SelfConfiguring, EnrichingParser, Parser, RenderingParser

public class PDFParser extends Object implements Parser, RenderingParser, EnrichingParser
PDF parser.

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.

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 many pdfs do not store table structures. So you should not expect table markup for what looks like a table. 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. If your PDFs contain marked content or tags, consider PDFParserConfig.setMarkedContent(MarkedContentConfig)

See Also:
  • Field Details

    • MEDIA_TYPE

      public static final MediaType MEDIA_TYPE
  • Constructor Details

    • PDFParser

      public PDFParser()
    • PDFParser

      public PDFParser(PDFParserConfig config)
      Constructor with explicit PDFParserConfig object.
      Parameters:
      config - the configuration
    • PDFParser

      public PDFParser(JsonConfig jsonConfig)
      Constructor for JSON configuration. Requires Jackson on the classpath.
      Parameters:
      jsonConfig - JSON configuration
  • Method Details