private void _writeTrailer14() { // Write xref table int posXrefTable = _writer.PdfPosition; _writer.WriteXrefHeader(_xrefTable.Count); { int v; int p; byte[] buf = new byte[20]; for (int ObjectID = 0; ObjectID < _xrefTable.Count; ++ObjectID) { PdfWriterReference entry = _xrefTable[ObjectID]; v = (entry != null) ? entry.Position : 0; for (p = 0; p < 10; ++p) { buf[9 - p] = (byte)('0' + (v % 10)); v /= 10; } buf[10] = (byte)' '; v = (entry != null) ? 0 : 65535; for (p = 0; p < 5; ++p) { buf[15 - p] = (byte)('0' + (v % 10)); v /= 10; } buf[16] = (byte)' '; buf[17] = (byte)((entry != null) ? 'n' : 'f'); buf[18] = (byte)' '; buf[19] = (byte)'\n'; _writer.WriteByteArray(buf, 0, 20); } } // write trailer _writer.WriteTrailer(); _writer.WriteDictionaryBegin(); { // Size { _writer.WriteName("Size"); _writer.WriteInteger(_xrefTable.Count); } // Root { _writer.WriteName("Root"); _writer.WriteReference(GetReference(_catalog)); } // Info { _writer.WriteName("Info"); _writer.WriteReference(GetReference(_documentInfo)); } // ID { _writer.WriteName("ID"); _writer.WriteArrayBegin(); _writer.WriteStringHex(System.Guid.NewGuid().ToByteArray()); _writer.WriteStringHex(System.Guid.NewGuid().ToByteArray()); _writer.WriteArrayEnd(); } } _writer.WriteDictionaryEnd(); _writer.WriteNewLine(); // write startxref and EOF _writer.WriteEOF(posXrefTable); }