public override void Generate() { var font = FontFactory.GetFont("Times New Roman", 10); var sectionFont = FontFactory.GetFont("Times New Roman", 16, Font.BOLD); base.Generate(); var table = new AttachmentTable(); foreach (var attachment in Settings.Attachments) { string attachmentName = null; if (attachment.IsSection) { if (table.Rows.Any() && table.Complete) { FormatTableCells(table, 20); Document.Add(table); Document.NewPage(); table = new AttachmentTable(); } var sectionHeader = MakeCell(attachment.SectionHeader, sectionFont); sectionHeader.Colspan = 2; table.AddCell(sectionHeader); } if (attachment.HasAttachment) { attachmentName = Path.GetFileName(attachment.AttachmentPath); var fileSpec = PdfFileSpecification.FileEmbedded(Writer, attachment.AttachmentPath, attachmentName, null); fileSpec.AddDescription(attachmentName, false); Writer.AddFileAttachment(fileSpec); } if (attachment.HasThumbnail) { var image = Image.GetInstance(attachment.ThumbnailPath, true); var cell = new PdfPCell(image) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; if (attachment.HasAttachment) { cell.CellEvent = new ThumbnailLayoutHandler(attachmentName, Writer); } if (!attachment.HasDescriptiveText) { cell.Colspan = 2; } table.AddCell(cell); } if (!attachment.HasDescriptiveText) { continue; } var description = MakeCell(attachment.DescriptiveText, font); description.VerticalAlignment = Element.ALIGN_MIDDLE; if (!attachment.HasThumbnail) { description.Colspan = 2; } table.AddCell(description); } FormatTableCells(table, 20); Document.Add(table); }