Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-161

java.util.EmptyStackException from PDFTextStripper.writeText

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.8.4, 2.0.0
    • Text extraction
    • None

    Description

      [imported from SourceForge]
      http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1483833
      Originally submitted by gagravarr on 2006-05-08 07:05.

      I'm using PDFBox 0.7.2. On a certain document
      (http://www-wds.worldbank.org/external/default/WDSContentServer/IW3P/IB/2005/12/27/000160016_20051227181308/Rendered/PDF/E12860v10P096469EAs.pdf),
      when I execute the following code:

      PDFParser pdfParser = new PDFParser( docStream );
      pdfParser.parse();
      PDDocument pdfDocument = pdfParser.getPDDocument();

      StringWriter textWriter = new StringWriter();
      PDFTextStripper textStripper = new PDFTextStripper();
      textStripper.writeText(pdfDocument, textWriter);

      I get the following nasty stack trace from deep inside
      PDFBox:

      Exception in thread "main" java.util.EmptyStackException
      at java.util.Stack.peek(Stack.java:79)
      at java.util.Stack.pop(Stack.java:61)
      at
      org.pdfbox.util.operator.GRestore.process(GRestore.java:65)
      at
      org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:
      494)
      at
      org.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java
      :207)
      at
      org.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:16
      0)
      at
      org.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:355)
      at
      org.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:268
      )
      at
      org.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:220)

      Attachments

        1. PDFBOX161-E12860v10P096469EAs.pdf
          1.06 MB
          Andreas Lehmkühler

        Issue Links

          Activity

            People

              lehmi Andreas Lehmkühler
              Anonymous Anonymous
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: