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

Handle correctly special characters while writing COSString

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Do
    • 2.0.8
    • None
    • Writing
    • None
    • Patch
    • Hide
      Table 3 – Escape sequences in literal strings
      Sequence Meaning
      \n LINE FEED (0Ah) (LF)
      \r CARRIAGE RETURN (0Dh) (CR)
      \t HORIZONTAL TAB (09h) (HT)
      \b BACKSPACE (08h) (BS)
      \f FORM FEED (FF)
      \( LEFT PARENTHESIS (28h)
      \) RIGHT PARENTHESIS (29h)
      \\ REVERSE SOLIDUS (5Ch) (Backslash)
      Show
      Table 3 – Escape sequences in literal strings Sequence Meaning \n LINE FEED (0Ah) (LF) \r CARRIAGE RETURN (0Dh) (CR) \t HORIZONTAL TAB (09h) (HT) \b BACKSPACE (08h) (BS) \f FORM FEED (FF) \( LEFT PARENTHESIS (28h) \) RIGHT PARENTHESIS (29h) \\ REVERSE SOLIDUS (5Ch) (Backslash)

    Description

      Regarding to case PDFBOX-3107. There was change in CosWritter.java that if string contains characters CR (0x0d) and LF (0x0a) the string is written in hex format. This may be ok, but PDF specification (7.3.4.2 Literal Strings) explicitly defines more characters that should handle specially.

      I'm providing another version of the code that handles all special characters without transforming to hex format.

      PR #41

      Attachments

        1. Contains_tab_ok.pdf
          4 kB
          Ladislav Dudáš
        2. Contains_tab_bad.pdf
          4 kB
          Ladislav Dudáš
        3. Contains_tab_bad_offset-corrected.pdf
          4 kB
          Tilman Hausherr
        4. Contains_tab_bad_offset-corrected-saved_by_adobe.pdf
          6 kB
          Tilman Hausherr
        5. Tab in Title - Foxit.pdf
          2 kB
          Ladislav Dudáš

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dudasl Ladislav Dudáš
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified