Two problems that I see (not looking at the stream data.
" Size integer (required) Number one is greater than the highest object number used in this section, or in any section for which this will be an update. It should be equivalent to writing the size in the trailer dictionary."
your size should be ... 14.
" Index (optional) An array containing a pair of integers for each subsection in this section. The first integer must be the first number of the object in the subsection, the second integer records in the subsection The array is sorted in ascending order by the number of the object. The subsections cannot intersect; the object number may contain no more than one entry per section. Default value: [0 Size]. "
Your index should probably skip a bit. You have no 2-4 or 7. objects. The index array should reflect this.
Your data is also wrong (and I just learned to read the xref stream.).
00 00 00
01 00 0a
01 00 47
01 01 01
01 01 70
01 02 fd
01 76 f1
01 84 6b
01 84 a1
01 85 4f
According to these data, which, due to your “index no”, are interpreted as object numbers from 0 to 9, they have the following offset:
0 is not used. Fine
1 is at 0x0a. Yes, of course, 2 is at 0x47. Nope. This approaches the start of the “1 0” stream. This is probably not a coincidence.
3 is at 0x101. Nope. 0x101 is still in the stream "1 0".
4 is located at 0x170. Also
5 is at 0x2fd. Also
6 is at 0x76f1. No, and this time buried inside this stream of images.
I think you get the point. Thus, even if you had the correct \ Index, your offsets are all wrong (and completely different from what in resultNormal.pdf, even considering random defragmentation).
What do you want to find in resultNormal xref:
xref
0 2
0000000000 65535 f
0000000010 00000 n
5 2
0000003460 00000 n
0000003514 00000 n
8 5
0000003688 00000 n
0000003749 00000 n
0000003935 00000 n
0000004046 00000 n
0000004443 00000 n
So, your index should be (if I read this right): \ Index [0 2 5 2 8 5]. And the data:
0 0 0
1 0 a
1 3460 (this is a decimal number)
1 3514 (same)
1 3688
etc.
Interestingly, the PDF specification says that the size should be BOTH the number of entries in this and all previous XRefs and number one is higher than the highest object number that is used.
I don’t think the later part is ever applied, but I won’t be surprised if I find that xref streams are more persistent than regular cross-reference tables. Maybe it will be the same code processing, maybe not.
@mtraut:
Here is what I see:
13 0 obj
<</Size 10/Length 44/Filter /FlateDecode/DecodeParms <</Columns 3/Predictor 12>>/W [1 2 0]/Type /XRef/Root 8 0 R>>
flow
...
endstream
endobj