Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Rendering
    • Labels:
      None
    • Environment:
      Oracle Java8 - Windows 8.1 x64

      Description

      texts in PDF are not rendered when is present shadow.
      The url contains 4 pdf of the same page, exported in 4 different ways. In few cases one the last text line are not rendered.

      https://drive.google.com/drive/u/0/folders/0Bz-TZKnUq0uufmVLUDliMFBGSGRWZU1sQWVJamQ5VV9mOGxaMXhTOXZuSVhQd3Vpc280Z2M

      1. PDFBOX-2814.pdf
        213 kB
        Tilman Hausherr
      2. PDFBOX-2814.png
        258 kB
        Tilman Hausherr

        Issue Links

          Activity

          Hide
          tilman Tilman Hausherr added a comment - - edited

          I looked at the first file only. It has "in verde lo" at the bottom which is unseen.

          BT
          7 Tr
          .35 Tc
          /F2 14 Tf
          /GS3 gs
          [(in v)20(er)40(de l)2(o )]TJ
          ET
          q
          .77 -.252 62.09 10.22 re
          W* n
          /GS1 gs
          62.88 0 0 11.04 .29 -.732 cm
          /I4 Do
          Q
          

          It is rendered in mode 7 (Add text to path for clipping = NEITHER_CLIP). I.e. the path of the text is used to clip a part of a mostly black image (/I4).

          Changing the TJ line to

          [(in verde lo)     ]TJ
          

          shows the text, although in poor quality. This looks to me as if adding the shapes to the clipping path doesn't work properly for TJ if there are several elements.

          John Hewson In PageDrawer.showText(), the textClippingArea is reset at the beginning of each call, and at the end, state.intersectClippingPath(textClippingArea); is called. So if showText() is called several times as it is done in TJ, the intersection would be empty

          Show
          tilman Tilman Hausherr added a comment - - edited I looked at the first file only. It has "in verde lo" at the bottom which is unseen. BT 7 Tr .35 Tc /F2 14 Tf /GS3 gs [(in v)20(er)40(de l)2(o )]TJ ET q .77 -.252 62.09 10.22 re W* n /GS1 gs 62.88 0 0 11.04 .29 -.732 cm /I4 Do Q It is rendered in mode 7 (Add text to path for clipping = NEITHER_CLIP). I.e. the path of the text is used to clip a part of a mostly black image (/I4). Changing the TJ line to [(in verde lo) ]TJ shows the text, although in poor quality. This looks to me as if adding the shapes to the clipping path doesn't work properly for TJ if there are several elements. John Hewson In PageDrawer.showText(), the textClippingArea is reset at the beginning of each call, and at the end, state.intersectClippingPath(textClippingArea); is called. So if showText() is called several times as it is done in TJ, the intersection would be empty
          Hide
          jahewson John Hewson added a comment -

          Tilman Hausherr, that's exactly the problem. The buffering of the text clip needs wrap showTextString(...) and showTextStrings(...) instead of showText(...).

          Show
          jahewson John Hewson added a comment - Tilman Hausherr , that's exactly the problem. The buffering of the text clip needs wrap showTextString(...) and showTextStrings(...) instead of showText(...).
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 1682140 from John Hewson in branch 'pdfbox/trunk'
          [ https://svn.apache.org/r1682140 ]

          PDFBOX-2814: Collect text clip across TJ characters

          Show
          jira-bot ASF subversion and git services added a comment - Commit 1682140 from John Hewson in branch 'pdfbox/trunk' [ https://svn.apache.org/r1682140 ] PDFBOX-2814 : Collect text clip across TJ characters
          Hide
          jahewson John Hewson added a comment -

          This fixes the missing text. The quality is low because Java2D doesn't have anti-aliased clipping. A workaround is to render at a higher DPI, say 8x and scale-down the resulting image.

          Show
          jahewson John Hewson added a comment - This fixes the missing text. The quality is low because Java2D doesn't have anti-aliased clipping. A workaround is to render at a higher DPI, say 8x and scale-down the resulting image.
          Hide
          tilman Tilman Hausherr added a comment -

          Daniele guiducci it is a bit weird that you're using that mode 7 for parts of the text only, and it just makes your PDF bigger. You could just output the text in the desired color, like it is done elsewhere. Usually mode 7 is used to clip from an "interesting" background, e.g. a shading or a nice image (for example, the words "surfing" clipped from an image of a wave). It doesn't really make sense for a uniform color. To see what I'm writing about, go to PDFBOX-678 and open the example 26 file.

          Show
          tilman Tilman Hausherr added a comment - Daniele guiducci it is a bit weird that you're using that mode 7 for parts of the text only, and it just makes your PDF bigger. You could just output the text in the desired color, like it is done elsewhere. Usually mode 7 is used to clip from an "interesting" background, e.g. a shading or a nice image (for example, the words "surfing" clipped from an image of a wave). It doesn't really make sense for a uniform color. To see what I'm writing about, go to PDFBOX-678 and open the example 26 file.
          Hide
          daniele.guiducci Daniele guiducci added a comment -

          Tilman Hausherr Thank you
          i know that this pdf are not well structured, but we already have hundreds of this files and we can't edit them.

          Show
          daniele.guiducci Daniele guiducci added a comment - Tilman Hausherr Thank you i know that this pdf are not well structured, but we already have hundreds of this files and we can't edit them.
          Hide
          tilman Tilman Hausherr added a comment -

          The file of PDFBOX-301 has also improved, the text "L’Wren Scotts ..." near the small "2" is now rendered.

          Show
          tilman Tilman Hausherr added a comment - The file of PDFBOX-301 has also improved, the text "L’Wren Scotts ..." near the small "2" is now rendered.

            People

            • Assignee:
              Unassigned
              Reporter:
              daniele.guiducci Daniele guiducci
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development