Skip to main content
Participant
Apr 2, 2020 10:24 AM UTC
Answered

Tw and Tc operators ignored by acrobat reader

Hi All. I coded a PDF generator and I am dealing with text justification. I think I have properly used the Tw and Tc operators; nevertheless when I open the resulting document with Acrobat Reader the text is left aligned as if those operators are zero. Attached is a very short PDF sample. What am I mistaking? Can anybody point me on the right way?

 

%PDF-1.4
%€€€€stdpdf
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/Count 1
/Kids [3 0 R]
>>
endobj
3 0 obj
<<
/Type /Page
/Contents 4 0 R
/MediaBox [0 0 595.35 834.5025]
/Parent 2 0 R
/Resources 5 0 R
>>
endobj
4 0 obj
<<
/Length 380
>>
stream
1 i 0 G 0 g
BT
51.75 766.576 Td 0.222 Tw 0.106 Tc /F1 23.641 Tf (nel mezzo del) Tj
ET
BT
51.75 733.144 Td 0.138 Tw 0 Tc (cammin di nostra) Tj
ET
BT
51.75 699.711 Td 0 Tw 0 Tc (vita mi ritrovai per) Tj
ET
BT
51.75 666.278 Td 0.165 Tw 0 Tc (una selva oscura) Tj
ET
BT
51.75 632.845 Td 0.222 Tw 0.0162 Tc (ché la diritta via) Tj
ET
BT
51.75 599.412 Td 0 Tw 0 Tc (era smarrita) Tj
ET

endstream
endobj
5 0 obj
<<
/Font <<
/F1 6 0 R
>>
/ProcSet [true true true true true]
>>
endobj
6 0 obj
<<
/Type /Font
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
/Subtype /Type1
>>
endobj
7 0 obj
<<
/CreationDate (D:20200402120550+01'00)
/Creator (PdfFormFiller)
/ModDate (D:20200402120550+01'00)
/Producer (PdfFormFiller)
>>
endobj
xref
0 8
0000000000 65535 f
0000000021 00000 n
0000000070 00000 n
0000000127 00000 n
0000000239 00000 n
0000000670 00000 n
0000000749 00000 n
0000000846 00000 n
trailer
<<
/Info 7 0 R
/Root 1 0 R
/Size 8
>>
startxref
991
%%EOF

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Test Screen NameCorrect answer
    Legend
    Apr 2, 2020 3:36 PM UTC

    So you are assuming that Tc is scaled by Tf. But that's not my reading of the formula in the PDF Reference.

    3 replies

    Legend
    Apr 2, 2020 11:00 AM UTC

    If you want people to examine a PDF you need to post a link to the real PDF, because many problems happen from bad xref, etc. However, I have a simple question for you. What effect EXACTLY do you expect "0.138 Tw 0 Tc" to have in 

    "51.75 733.144 Td 0.138 Tw 0 Tc (cammin di nostra) Tj"?

    Translate
    rpaulin56Author
    Participant
    Apr 2, 2020 2:42 PM UTC

    below a link to the PDF, I hope it is ok. About your question: I woud expect "0.138 Tw 0 Tc" to enlarge each of the 2 spaces among the the three words by 0.138 * 23.641, i.e. 3.26 points, which should be about 50%  more than the normal; but when I open the PDF I see no difference between any of the spaces (nor among characters, in the lines when the Tc is > 0).

    https://www.dropbox.com/s/2t2w1k4kghdpgzn/temp%20filled.pdf?dl=0

     

    Thanks for your attention

    Translate
    Test Screen NameCorrect answer
    Legend
    Apr 2, 2020 3:36 PM UTC

    So you are assuming that Tc is scaled by Tf. But that's not my reading of the formula in the PDF Reference.

    Translate