public byte[] Generate() { var generator = new PdfGenerator(); generator.AddCatalog(_catalog); generator.AddObject(_pages); foreach (var fontObject in _fonts.ToDictionary()) { generator.AddObject(fontObject.Value); generator.AddObject(fontObject.Value.FontDescriptor); generator.AddObject(fontObject.Value.FontWidths); } foreach (var xObject in _xObjects.ToDictionary()) { generator.AddObject(xObject.Value); } foreach (var pageObject in _pageObjects) { generator.AddObject(pageObject.Contents); generator.AddObject(pageObject); } return generator.GetBytes(); }