public override List<byte> GetOutput() { Document.CrossReferenceTable.Entries.Add(new XRefEntry(Document.CurrentBytes, 0, false)); var builder = new StringBuilder(); builder.AppendLine(GetObjectHeader()); builder.AppendLine("<<"); foreach (var kv in Dictionary) { builder.AppendLine(kv.Key + " " + kv.Value); } builder.AppendLine(PageTree.GetIndirectReference()); if (Outline != null) builder.AppendLine(Outline.GetIndirectReference()); builder.AppendLine(">>"); builder.AppendLine("endobj"); var bytes = new ASCIIEncoding().GetBytes(builder.ToString()).ToList(); Document.CurrentBytes += bytes.Count; bytes.AddRange(PageTree.GetOutput()); if (Outline != null) bytes.AddRange(Outline.GetOutput()); return bytes; }
public override List<byte> GetOutput() { Document.CrossReferenceTable.Entries.Add(new XRefEntry(Document.CurrentBytes, 0, false)); var builder = new StringBuilder(); builder.AppendLine(GetObjectHeader()); builder.AppendLine("<<"); foreach (var kv in Dictionary) { builder.AppendLine(kv.Key + " " + kv.Value); } builder.Append("/Kids ["); if (Pages.Count > 0) builder.Append(Pages[0].GetMinimalIndirectReference()); foreach (var page in Pages.Skip(1)) { builder.Append(" " + page.GetMinimalIndirectReference()); } builder.Append("]\n"); builder.AppendLine("/Count " + Pages.Count); builder.AppendLine(">>"); builder.AppendLine("endobj"); var bytes = new ASCIIEncoding().GetBytes(builder.ToString()).ToList(); Document.CurrentBytes += bytes.Count; foreach (var page in Pages) { bytes.AddRange(page.GetOutput()); } return bytes; }