public PdfDocument ExportAll(IExportablePack <Module> pack) { Document pre = new Document(); pre.AddSection(); PdfDocumentRenderer rend = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); rend.Document = pre; rend.RenderDocument(); return(rend.PdfDocument); }
public BufferedStream ExportAllAsStream(IExportablePack <Module> pack) { MemoryStream ms = new MemoryStream(); ExportAll(pack).Save(ms, false); byte[] bytes = ms.ToArray(); ms.Write(bytes, 0, bytes.Length); ms.Position = 0; return(new BufferedStream(ms)); }
/// <summary> /// Basic export function to generate PDF from a list of elements /// </summary> /// <param name="pack">pack containing elements to export and arguments to specify the format</param> /// <returns>A PDF Document</returns> public PdfDocument ExportAll(IExportablePack <FaseType> pack) { Document prePdf = new Document(); //Document markup DefineStyles(prePdf); BuildCover(prePdf, "Module-Overzicht voor Informatica"); DefineTableOfContents(prePdf, pack.ToExport); //Here starts the real exporting LessenTabelExporterFactory ltef = new LessenTabelExporterFactory(); lessenTabelExporterStrategy = ltef.GetStrategy(pack.Options as LessenTabelExportArguments); foreach (FaseType ft in pack.ToExport) { Section sect = prePdf.AddSection(); try { sect = lessenTabelExporterStrategy.Export(ft, sect); } catch (Exception e) { sect.AddParagraph("An error has occured while invoking an export-function on FaseType: " + ft.Type + "\n" + e.Message, "error"); } //Page numbers (only for multi-export) Paragraph p = new Paragraph(); p.AddPageField(); sect.Footers.Primary.Add(p); sect.Footers.EvenPage.Add(p.Clone()); } PdfDocumentRenderer rend = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); rend.Document = prePdf; rend.RenderDocument(); return(rend.PdfDocument); }