Class PdfContentReaderTool


  • public class PdfContentReaderTool
    extends java.lang.Object
    Tool that parses the content of a PDF document.
    Since:
    2.1.4
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getDictionaryDetail​(PdfDictionary dic)
      Shows the detail of a dictionary.
      static java.lang.String getDictionaryDetail​(PdfDictionary dic, int depth)
      Shows the detail of a dictionary.
      static java.lang.String getXObjectDetail​(PdfDictionary resourceDic)
      Displays a summary of the entries in the XObject dictionary for the stream
      static void listContentStream​(java.io.File pdfFile, int pageNum, java.io.PrintWriter out)
      Writes information about the specified page in a PDF file to the specified output stream.
      static void listContentStream​(java.io.File pdfFile, java.io.PrintWriter out)
      Writes information about each page in a PDF file to the specified output stream.
      static void listContentStreamForPage​(PdfReader reader, int pageNum, java.io.PrintWriter out)
      Writes information about a specific page from PdfReader to the specified output stream.
      static void main​(java.lang.String[] args)
      Writes information about each page in a PDF file to the specified file, or System.out.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PdfContentReaderTool

        public PdfContentReaderTool()
    • Method Detail

      • getDictionaryDetail

        public static java.lang.String getDictionaryDetail​(PdfDictionary dic)
        Shows the detail of a dictionary. This is similar to the PdfLister functionality.
        Parameters:
        dic - the dictionary of which you want the detail
        Returns:
        a String representation of the dictionary
      • getDictionaryDetail

        public static java.lang.String getDictionaryDetail​(PdfDictionary dic,
                                                           int depth)
        Shows the detail of a dictionary.
        Parameters:
        dic - the dictionary of which you want the detail
        depth - the depth of the current dictionary (for nested dictionaries)
        Returns:
        a String representation of the dictionary
      • getXObjectDetail

        public static java.lang.String getXObjectDetail​(PdfDictionary resourceDic)
                                                 throws java.io.IOException
        Displays a summary of the entries in the XObject dictionary for the stream
        Parameters:
        resourceDic - the resource dictionary for the stream
        Returns:
        a string with the summary of the entries
        Throws:
        java.io.IOException
        Since:
        5.0.2
      • listContentStreamForPage

        public static void listContentStreamForPage​(PdfReader reader,
                                                    int pageNum,
                                                    java.io.PrintWriter out)
                                             throws java.io.IOException
        Writes information about a specific page from PdfReader to the specified output stream.
        Parameters:
        reader - the PdfReader to read the page content from
        pageNum - the page number to read
        out - the output stream to send the content to
        Throws:
        java.io.IOException
        Since:
        2.1.5
      • listContentStream

        public static void listContentStream​(java.io.File pdfFile,
                                             java.io.PrintWriter out)
                                      throws java.io.IOException
        Writes information about each page in a PDF file to the specified output stream.
        Parameters:
        pdfFile - a File instance referring to a PDF file
        out - the output stream to send the content to
        Throws:
        java.io.IOException
        Since:
        2.1.5
      • listContentStream

        public static void listContentStream​(java.io.File pdfFile,
                                             int pageNum,
                                             java.io.PrintWriter out)
                                      throws java.io.IOException
        Writes information about the specified page in a PDF file to the specified output stream.
        Parameters:
        pdfFile - a File instance referring to a PDF file
        pageNum - the page number to read
        out - the output stream to send the content to
        Throws:
        java.io.IOException
        Since:
        2.1.5
      • main

        public static void main​(java.lang.String[] args)
        Writes information about each page in a PDF file to the specified file, or System.out.
        Parameters:
        args -