code: static public void listContentStreamForPage(PdfReader reader, int pageNum, PrintWriter out) throws IOException {
          out.println("==============Page " + pageNum + "====================");
          out.println("- - - - - Dictionary - - - - - -");
          PdfDictionary pageDictionary = reader.getPageN(pageNum);
          out.println(getDictionaryDetail(pageDictionary));
          out.println("- - - - - Content Stream - - - - - -");
          RandomAccessFileOrArray f = reader.getSafeFile();
          
          byte[] contentBytes = reader.getPageContent(pageNum, f);
          f.close();
  
          
          InputStream is = new ByteArrayInputStream(contentBytes);
          int ch;
          while ((ch = is.read()) != -1){
              out.print((char)ch);
          }
  
          out.println("- - - - - Text Extraction - - - - - -");
          PdfTextExtractor extractor = new PdfTextExtractor(reader);
          String extractedText = extractor.getTextFromPage(pageNum);
          if (extractedText.length() != 0)
              out.println(extractedText);
          else
              out.println("No text found on page " + pageNum);
          
          out.println();
          
      }
docs: Writes information about a specific page from PdfReader to the specified output stream.
  @since 2.1.5
  @param reader    the PdfReader to read the page content from
  @param pageNum   the page number to read
  @param out       the output stream to send the content to
  @throws IOException