public static PdfSharp.Pdf.PdfDocument Add(this PdfSharp.Pdf.PdfDocument document, Stream stream) { if (document == null) throw new ArgumentNullException("document"); if (stream == null) throw new ArgumentNullException("file"); PdfSharp.Pdf.PdfDocument reportDocument = CompatiblePdfReader.Open(stream); foreach (PdfSharp.Pdf.PdfPage page in reportDocument.Pages) { document.AddPage(page); } return document; }
public static RazorPage AddFileAndPage(this RazorFormat razorFormat, string filePath, string contents) { razorFormat.VirtualFileSources.WriteFile(filePath, contents); return razorFormat.AddPage(filePath); }
public static void AddFileAndPage(this MarkdownFormat markdown, MarkdownPage markdownPage) { var pathProvider = (InMemoryVirtualPathProvider)markdown.VirtualPathProvider; pathProvider.AddFile(markdownPage.FilePath, markdownPage.Contents); markdown.AddPage(markdownPage); }
/// <summary>A RazorFormat extension method that adds a file and page.</summary> /// /// <param name="razorFormat">The razorFormat to act on.</param> /// <param name="filePath"> Full pathname of the file.</param> /// <param name="contents"> The contents.</param> /// /// <returns>A RazorPage.</returns> public static RazorPage AddFileAndPage(this RazorFormat razorFormat, string filePath, string contents) { var pathProvider = (IWriteableVirtualPathProvider)razorFormat.VirtualPathProvider; pathProvider.AddFile(filePath, contents); return razorFormat.AddPage(filePath); }