5 Replies Latest reply: May 14, 2014 12:56 AM by lrosenth RSS

    TJ operator does NOT display all glyph

    OleK Community Member

      Hi everyone,

       

      I have a strange behaviour when generating a PDF document by using the TJ operator:

      I am using the TJ to justify multibyte glyphs.

       

      For example this:

      BT 297.640 640.940 Td /F1 10.0 Tf () Tj /F2 10.0 Tf [(Lorum) 459 (Ipsum) 459 (dolar,) 459 (etc) 459 (June) 459 (4th,)] TJ /F1 10.0 Tf ET

       

      is rendered correctly justified in Chrome viewer and Foxit Reader.

       

      But the same PDF document in Acrobat Reader and Adobe Acrobat 9.0 is only showing "Lorum dolar, June".

      So "Ispum", "etc" and "4th" are missing.

       

      Acrobat Preflight reports the following error:

      problem.PNG

       

      Any ideas?

      Thank you in advance

        • 1. Re: TJ operator does NOT display all glyph
          lrosenth Adobe Employee

          Please post the full PDF so that we can examine all related parts.

          • 2. Re: TJ operator does NOT display all glyph
            OleK Community Member

            You can download the PDF here: https://sourceforge.net/p/pdf-php/discussion/experimental/thread/78be05ac/

             

            Below is the content of this PDF document:

             

             

            %PDF-1.3

            %âãÏÓ
            1 0 obj
            << /Type /Outlines /Count 0 >>
            endobj
            2 0 obj
            << /Type /Pages /Resources << /ProcSet [/PDF/TEXT/ImageB/ImageC/ImageI] /ColorSpace << /CS0 7 0 R >> /ExtGState << /GS0 17 0 R/GS1 18 0 R >> /Font << /F1 4 0 R /F2 10 0 R >> >> /Count 1 /Kids [3 0 R ] >>
            endobj
            3 0 obj
            << /Type /Page /Parent 2 0 R /MediaBox [0.000 0.000 595.280 841.890] /CropBox [0.000 0.000 595.280 841.890] /BleedBox [50.000 50.000 545.280 751.890] /Contents [16 0 R 17 0 R ] >>
            endobj
            4 0 obj
            << /Type /Font /Subtype /Type0 /BaseFont /EECFBD+gothmbok /Name /F1 /Encoding /Identity-H /DescendantFonts [9 0 R] /ToUnicode 6 0 R >>
            endobj
            5 0 obj
            <</Length1 9464 /Length 9464 >>
            stream
            [...]
            endstream
            endobj
            6 0 obj
            << /Length 346 >>
            stream
            /CIDInit /ProcSet findresource begin
            12 dict begin
            begincmap
            /CIDSystemInfo <</Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def
            /CMapName /Adobe-Identity-UCS def
            /CMapType 2 def
            1 begincodespacerange
            <0000> <FFFF>
            endcodespacerange
            1 beginbfrange
            <0000> <FFFF> <0000>
            endbfrange
            endcmap
            CMapName currentdict /CMap defineresource pop
            end
            end
            endstream
            endobj
            7 0 obj
            << /Length 131072 >>
            stream
                 [...]
            endstream
            endobj
            8 0 obj
            << /Type /FontDescriptor /Flags 32 /StemV 70/FontName /EECFBD+gothmbok /Ascent 907 /Descent -170 /FontBBox [-68 -169 1158 907] /ItalicAngle 0.0 /MaxWidth 1158 /MissingWidth 600 /FontFile2 5 0 R >>
            endobj
            9 0 obj
            << /Type /Font /Subtype /CIDFontType2 /BaseFont /EECFBD+gothmbok /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor 8 0 R /CIDToGIDMap 7 0 R /W [ 32 [300] 44 [245] 46 [245] 65 [790] 76 [619] 83 [640] 97 [579 664 571 664 592] 103 [664] 105 [263 263 569 263 951 616 646 664 664 405 498 404 616 587] 121 [591] ] >>
            endobj
            10 0 obj
            << /Type /Font /Subtype /Type0 /BaseFont /BDDBFE+gothmmed /Name /F2 /Encoding /Identity-H /DescendantFonts [15 0 R] /ToUnicode 12 0 R >>
            endobj
            11 0 obj
            <</Length1 6948 /Length 6948 >>
            stream
            [...]
            endstream
            endobj
            12 0 obj
            << /Length 346 >>
            stream
            /CIDInit /ProcSet findresource begin
            12 dict begin
            begincmap
            /CIDSystemInfo <</Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def
            /CMapName /Adobe-Identity-UCS def
            /CMapType 2 def
            1 begincodespacerange
            <0000> <FFFF>
            endcodespacerange
            1 beginbfrange
            <0000> <FFFF> <0000>
            endbfrange
            endcmap
            CMapName currentdict /CMap defineresource pop
            end
            end
            endstream
            endobj
            13 0 obj
            << /Length 131072 >>
            stream
                 [...]
            endstream
            endobj
            14 0 obj
            << /Type /FontDescriptor /Flags 32 /StemV 70/FontName /BDDBFE+gothmmed /Ascent 922 /Descent -172 /FontBBox [-70 -170 1180 922] /ItalicAngle 0.0 /MaxWidth 1180 /MissingWidth 600 /FontFile2 11 0 R >>
            endobj
            15 0 obj
            << /Type /Font /Subtype /CIDFontType2 /BaseFont /BDDBFE+gothmmed /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor 14 0 R /CIDToGIDMap 13 0 R /W [ 32 [300] 44 [269] 76 [619] 97 [587 670 571 670 604] 103 [670] 105 [286] 108 [286 950 620 657 670] 114 [413 500 410 620 595] 121 [596] ] >>
            endobj
            16 0 obj
            << /Length 21 >> stream
            0.000 0.000 0.000 rg
            endstream
            endobj
            17 0 obj
            << /Length 1826 >> stream
            0.000 0.000 0.000 rg
            BT 297.640 640.940 Td /F1 10.0 Tf () Tj /F2 10.0 Tf [(Lorem) -277 (ipsum) -277 (dolor) -277 (sit) -277 (amet,) -277 (consetetur)] TJ /F1 10.0 Tf ET
            BT 297.640 630.180 Td /F1 10.0 Tf () Tj /F2 10.0 Tf [(sadipscing) -45 (elitr,) -45 (sed) -45 (diam) -45 (nonumy) -45 (eirmod)] TJ /F1 10.0 Tf ET
            BT 297.640 619.420 Td /F1 10.0 Tf () Tj /F2 10.0 Tf (tempor invidunt ut labore) Tj /F1 10.0 Tf ET
            BT 297.640 596.200 Td /F1 10.0 Tf [(Lorem) -331 (ipsum) -331 (dolor) -331 (sit) -331 (amet,) -331 (consetetur)] TJ ET
            BT 297.640 585.440 Td /F1 10.0 Tf [(sadipscing) 686 (elitr,) 686 (sed) 686 (diam) 686 (nonumy) 686 (eirmod) 686 (tempor)] TJ ET
            BT 297.640 574.680 Td /F1 10.0 Tf [(invidunt) 681 (ut) 681 (labore) 681 (et) 681 (dolore) 681 (magna) 681 (aliquyam) 681 (erat,)] TJ ET
            BT 297.640 563.920 Td /F1 10.0 Tf [(sed) 448 (diam) 448 (voluptua.) 448 (At) 448 (vero) 448 (eos) 448 (et) 448 (accusam) 448 (et)] TJ ET
            BT 297.640 553.160 Td /F1 10.0 Tf [(justo) 422 (duo) 422 (dolores) 422 (et) 422 (ea) 422 (rebum.) 422 (Stet) 422 (clita) 422 (kasd)] TJ ET
            BT 297.640 542.400 Td /F1 10.0 Tf [(gubergren,) 289 (no) 289 (sea) 289 (takimata) 289 (sanctus) 289 (estLorem)] TJ ET
            BT 297.640 531.640 Td /F1 10.0 Tf [(ipsum) 694 (dolor) 694 (sit) 694 (amet.) 694 (Lorem) 694 (ipsum) 694 (dolor) 694 (sit) 694 (amet,)] TJ ET
            BT 297.640 520.880 Td /F1 10.0 Tf (consetetur) Tj ET
            endstream
            endobj
            18 0 obj
            << /Title (PDF Document Title) /Author (XXXXXXXX) /Producer (XXXXXXXX) /Description () /Subject () /Creator (XXXXXXXX) /CreationDate (D:20140513105518+00'00') /ModDate (D:20140513105518+00'00') /Trapped /False >>
            endobj
            19 0 obj
            << /Type /Catalog /Pages 2 0 R >>
            endobj
            xref
            0 20
            0000000000 65535 f
            0000000015 00000 n
            0000000061 00000 n
            0000000280 00000 n
            0000000475 00000 n
            0000000625 00000 n
            0000010154 00000 n
            0000010551 00000 n
            0000141677 00000 n
            0000141889 00000 n
            0000142255 00000 n
            0000142408 00000 n
            0000149422 00000 n
            0000149820 00000 n
            0000280947 00000 n
            0000281161 00000 n
            0000281503 00000 n
            0000281575 00000 n
            0000283454 00000 n
            0000283696 00000 n
            trailer
            << /Size 20 /Root 19 0 R /Info 18 0 R /ID [<21af1ba34c8347551486c6aca461d433><21af1ba34c8347551486c6aca461d433>] >>
            startxref
            283746
            %%EOF
            • 3. Re: TJ operator does NOT display all glyph
              OleK Community Member

              In addition to this I can provide you a WORKING PDF, which does not have the TJ operator but the Tj (lower-case 'j').

               

              You can download the WORKING PDF here: PHP Pdf creation - R&OS / Discussion / Experimental:TJ (array) operator with embeded TTF subset failure

              So the PDF content is 100% identical  with the previous post (incl. font program). The only exception is object 17 0.

               

              17 0 obj
              << /Length 1456 >> stream
              0.000 0.000 0.000 rg
              BT 297.640 640.940 Td /F1 10.0 Tf () Tj /F2 10.0 Tf (Lorem ipsum dolor sit amet, consetetur) Tj /F1 10.0 Tf ET
              BT 297.640 630.180 Td /F1 10.0 Tf () Tj /F2 10.0 Tf (sadipscing elitr, sed diam nonumy eirmod) Tj /F1 10.0 Tf ET
              BT 297.640 619.420 Td /F1 10.0 Tf () Tj /F2 10.0 Tf (tempor invidunt ut labore) Tj /F1 10.0 Tf ET
              BT 297.640 596.200 Td /F1 10.0 Tf (Lorem ipsum dolor sit amet, consetetur) Tj ET
              BT 297.640 585.440 Td /F1 10.0 Tf (sadipscing elitr, sed diam nonumy eirmod tempor) Tj ET
              BT 297.640 574.680 Td /F1 10.0 Tf (invidunt ut labore et dolore magna aliquyam erat,) Tj ET
              BT 297.640 563.920 Td /F1 10.0 Tf (sed diam voluptua. At vero eos et accusam et) Tj ET
              BT 297.640 553.160 Td /F1 10.0 Tf (justo duo dolores et ea rebum. Stet clita kasd) Tj ET
              BT 297.640 542.400 Td /F1 10.0 Tf (gubergren, no sea takimata sanctus estLorem) Tj ET
              BT 297.640 531.640 Td /F1 10.0 Tf (ipsum dolor sit amet. Lorem ipsum dolor sit amet,) Tj ET
              BT 297.640 520.880 Td /F1 10.0 Tf (consetetur) Tj ET
              endstream
              endobj

               

              Any ideas?

               

              Here are some screenshots of the "corrupted" PDF:

               

              test44-foxitreader.pngtest44-adobereader.pngtest44-adobeacrobat.png

              Chrome looks same as Foxit Reader

              • 4. Re: TJ operator does NOT display all glyph
                OleK Community Member

                Hi Folks,

                 

                I finally fixed it!

                Because the text is UTF-16BE encoded I mistakenly removed the NULL byte while justifiying.. That causes the problem in Adobe Reader and Acrobat.

                Foxit Reader and Chrome Viewer seem to ignore thes null bytes if its string has NULL bytes at the end.

                 

                Anyway, it is fixed!

                Thank you

                 

                Ole K

                • 5. Re: TJ operator does NOT display all glyph
                  lrosenth Adobe Employee

                  Yup, that would do it!