Skip navigation
Crypozza
Currently Being Moderated

Please, help with Incremental Update for Linearized document.

May 7, 2012 7:35 AM

Hi, here is my problem.
I'm working in my own annotation app. It incrementally updates pdfs. Works fine with most of the pdfs.
But i've found couple of pdfs, that was being corrupted after updating.

 

Here goes more details:
Single page-linearized pdf: when i've looked into pdf source, i found that page object has /Parent key which referencing to non-existing object. Normally, as i understand /Parent for page object is /Type /Pages objects with /Kids /Count etc.


12 0 obj

<</ArtBox[26 0 585.999 792]/BleedBox[26 0 586 792]/Contents[14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R]/CropBox[0 0 612 792]/MediaBox[0 0 612 792]/Parent 8 0 R/Resources 37 0 R/Rotate 0/TrimBox[26 0 586 792]/Type/Page>>

endobj

 

Parent 8 0 R - Is missing

 

But all pdf viewers are ok with that.
So, this pdf has two Xref tables:

 

36 0 obj

<</DecodeParms<</Columns 4/Predictor 12>>/Filter/FlateDecode/ID[<2C9B406A12A771465F8FE0D6A4DC67ED><9B829DD 8BDB09849A00CA5D75E75CDF4>]/Index[10 54]/Info 9 0 R/Length 114/Prev 66739/Root 11 0 R/Size 64/Type/XRef/W[1 2 1]>>stream....

 

and Second one at the end of file.

5 0 obj

<</DecodeParms<</Columns 5/Predictor 12>>/Filter/FlateDecode/ID[<2C9B406A12A771465F8FE0D6A4DC67ED><9B829DD 8BDB09849A00CA5D75E75CDF4>]/Info 9 0 R/Length 51/Root 11 0 R/Size 10/Type/XRef/W[1 3 1]>>stream

 

 

Linearized dict:

10 0 obj

<</Linearized 1/L 67043/O 12/E 48239/N 1/T 66738/H [ 534 185]>>

endobj

 

/T 66738 points to Xref table in 5 0 obj's stream

 

Now, when my annotation is stored: i'm adding the following object to the end of file:


8 0 obj <</Type /Pages/Count 1/Kids [ 12 0 R ]>>

endobj

 

I've create the missing 8 0 obj with Kids and /Count 1

12 0 obj<</Type /Page/Annots [ 65 0 R ]/ArtBox [ 26 0 585.999 792 ]/BleedBox [ 26 0 586 792 ]/Contents [ 14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R ]

/CropBox [ 0 0 612 792 ]/MediaBox [ 0 0 612 792 ]/Parent 8 0 R/Resources 37 0 R/Rotate 0/TrimBox [ 26 0 586 792 ]>>

endobj

 

it's page objects with new Reference to Annotation object which is:

 

65 0 obj<</Type /Annot/Contents (Test 2)/M (D:20120507172231+03'00')/Open true/P 12 0 R/Rect [ 0 0 100.000 100.000 ]/Subtype /Text/T(Test 1)>>

endobj

 

then goes my xref table

xref

8 1

0000067045 00000 n

0000067189 00000 n

0000067591 00000 n

trailer

<<

/ID [ <FE1185EC7443D19473E8A4A1569A1CB2> <FE1185EC7443D19473E8A4A1569A1CB2> ]

/Info 64 0 R

/Prev 66739

/Root 11 0 R

/Size 69

>>

startxref

67760

%%EOF

 

And this totally broks my PDF.
Questing: /Prev in my trailer should point ot 5 0 obj or 36 0 obj?

 
Replies
  • Currently Being Moderated
    May 7, 2012 7:45 AM   in reply to Crypozza

    AH – you can't mix classic xref tables with xref streams.  If the original file used streams, you MUST use streams.

     
    |
    Mark as:
  • Currently Being Moderated
    May 7, 2012 8:10 AM   in reply to Crypozza

    The one that was current/last before you updated it.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points