public void OutputTrailer() { FlushOutput(); foreach (PdfXObject xobj in xObjectsMap.Values) { resources.AddXObject(xobj); } xrefTable.Add(doc.Catalog.ObjectId, doc.Writer.Position); doc.Writer.WriteLine(doc.Catalog); xrefTable.Add(doc.Pages.ObjectId, doc.Writer.Position); doc.Writer.WriteLine(doc.Pages); foreach (PdfObject o in trailerObjects) { WritePdfObject(o); } // output the xref table long xrefOffset = doc.Writer.Position; xrefTable.Write(doc.Writer); // output the file trailer PdfFileTrailer trailer = new PdfFileTrailer(); trailer.Size = new PdfNumeric(doc.ObjectCount + 1); trailer.Root = doc.Catalog.GetReference(); trailer.Id = doc.FileIdentifier; if (info != null) { trailer.Info = info.GetReference(); } if (info != null && encrypt != null) { trailer.Encrypt = encrypt.GetReference(); } trailer.XRefOffset = xrefOffset; doc.Writer.Write(trailer); }
public void outputTrailer() { output(); foreach (PdfXObject xobj in xObjectsMap.Values) { resources.AddXObject(xobj); } xrefTable.Add(doc.Catalog.ObjectId, doc.Writer.Position); doc.Writer.WriteLine(doc.Catalog); xrefTable.Add(doc.Pages.ObjectId, doc.Writer.Position); doc.Writer.WriteLine(doc.Pages); foreach (PdfObject o in trailerObjects) { WritePdfObject(o); } // output the xref table long xrefOffset = doc.Writer.Position; xrefTable.Write(doc.Writer); // output the file trailer PdfFileTrailer trailer = new PdfFileTrailer(); trailer.Size = new PdfNumeric(doc.ObjectCount + 1); trailer.Root = doc.Catalog.GetReference(); trailer.Id = doc.FileIdentifier; if (info != null) { trailer.Info = info.GetReference(); } if (info != null && encrypt != null) { trailer.Encrypt = encrypt.GetReference(); } trailer.XRefOffset = xrefOffset; doc.Writer.Write(trailer); }