title: Why does the trailer of this pdf not conform PDF standard?
body: <p>Section 7.5.5 of to <a href="http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf" rel="nofollow noreferrer">pdf ISO 32000-1</a> says that</p>
  
  <blockquote>
    <p>The trailer of a PDF file enables a conforming reader to quickly find the cross-reference table and certain
    special objects. Conforming readers should read a PDF file from its end. The last line of the file shall contain
    only the end-of-file marker, %%EOF. The two preceding lines shall contain, one per line and in order, the
    keyword startxref and the byte offset in the decoded stream from the beginning of the file to the beginning of
    the xref keyword in the last cross-reference section. The startxref line shall be preceded by the trailer
    dictionary, consisting of the keyword trailer followed by a series of key-value pairs enclosed in double angle
    brackets (&lt;&lt;…>>) (using LESS-THAN SIGNs (3Ch) and GREATER-THAN SIGNs (3Eh)). </p>
  </blockquote>
  
  <p>But I found <a href="https://dn-tuna-podcast.qbox.me/attachment/2016-10-15-nfc-and-rfid.pdf" rel="nofollow noreferrer">this</a> pdf file does not follow this rule, though It may be opened by pdfviewer without any trouble. Specifically, the last 5 lines of this file is</p>
  
  <pre><code>trailer
  &lt;&lt;/Size 352/ID[&lt;9257C760F49955A23047D72C37914E79&gt;       &lt;82F1302E14912449A9BB43536F853CD6&gt;]&gt;&gt;
  startxref
  116
  %%EOF
  </code></pre>
  
  <p>Clearly this trailer dictionary is not correct, since the standard says that this dictionary must contain an entry with <code>Root</code> as the key, which this trailer does not have. Then I found that the offset 116 point to another xref table, which is located almost at the beginning of the file, and followed by another trailer which indeed contains a <code>Root entry</code>.</p>
  
  <pre><code>xref
  352 24
  0000000016 00000 n
  0000001914 00000 n
  0000001980 00000 n
  0000002147 00000 n
  ... ...
  trailer
  &lt;&lt;/Size 376/Root 353 0 R/Info 351 0 R/ID[&lt;9257C760F49955A23047D72C37914E79&gt;&lt;82F1302E14912449A9BB43536F853CD6&gt;]/Prev 4183097&gt;&gt;
  </code></pre>