Tika
  1. Tika
  2. TIKA-742

PDF2XHTML fails to insert <p> nor space around page marker

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0
    • Component/s: parser
    • Labels:
      None

      Description

      I have a test document (unfortunately not committable) whose page
      numbers are rendered with no separator (<p> nor space) before the next
      word. So I have words like:

      • 1Massachusetts
      • 2Course
      • 3also
      • 4The

      But then when I ran the ExtractText -html command-line from PDFBox, I
      can see that <p> is inserted after these page numbers (spookily, not
      closing the previous <p>; I opened PDFBOX-1130 for that).

      So I made a simple change to Tika's PDF2XHTML, to have it override the
      writeStart/EndParagraph, and call handler.start/EndElement("p"), ie to
      preserve the paragraph structure that PDFBOX detects out to the
      resulting XHTML handler, and this fixes the issue (I now see the page
      number as a separate paragraph, rendered w/ newline in "text" mode
      from TikaCLI).

      Note that this test document is the same document from PDFBOX-1129
      (there are some quote characters that are not extracted correctly).

      1. 000086.pdf
        41 kB
        Michael McCandless
      2. TIKA-742.patch
        5 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Patch.

        Show
        Michael McCandless added a comment - Patch.
        Hide
        Michael McCandless added a comment -

        PDF doc showing the issue (unfortunately not committable).

        Show
        Michael McCandless added a comment - PDF doc showing the issue (unfortunately not committable).

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development