【发布时间】:2014-12-28 14:19:32
【问题描述】:
我现在正在努力理解 PDF 敲击,但我在计算字符串的字节偏移量时遇到了一点问题。对象的偏移量是从文件开头到对象的索引(6 0 obj)计算出来的。
我有一个可用的 hello world PDF 文件,但是当我计算偏移量时,我得到的偏移量与外部参照表中的不同。
如果有人知道这是如何计算的,请告诉我!
例子:
0 6 obj xref:9 me:17
0 1 obj xref:60 me:72
0 4 obj xref:145 me 187
(我用 "\r\n" (2) 作为换行符)
%PDF-1.4
%%EOF
6 0 obj
<<
/Type /Catalog
/Pages 5 0 R
>>
endobj
1 0 obj
<<
/Type /Page
/Parent 5 0 R
/MediaBox [ 0 0 612 792 ]
/Resources 3 0 R
/Contents 2 0 R
>>
endobj
4 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /F1
/BaseFont/Helvetica
>>
endobj
2 0 obj
<<
/Length 53
>>
stream
BT
/F1 24 Tf
1 0 0 1 260 600 Tm
(Hello World)Tj
ET
endstream
endobj
5 0 obj
<<
/Type /Pages
/Kids [ 1 0 R ]
/Count 1
>>
endobj
3 0 obj
<<
/ProcSet[/PDF/Text]
/Font <</F1 4 0 R >>
>>
endobj
xref
0 7
0000000000 65535 f
0000000060 00000 n
0000000228 00000 n
0000000424 00000 n
0000000145 00000 n
0000000333 00000 n
0000000009 00000 n
trailer
<<
/Size 7
/Root 6 0 R
>>
startxref
488
%%EOF
【问题讨论】:
标签: pdf pdf-generation adobe offset postscript