A web based application, I am working on, must provide users with the ability to export a collection of articles to one single PDF document. This articles contain HTML code for formatting the text as well as positioning of various parts of the article.
Below is the code which I came up with for Exporting one single article:
var html = File.OpenText(artPath).ReadToEnd();
var buffer = new byte;
var pdfProvider = new PdfFormatProvider();
var htmlFormatProvider = new HtmlFormatProvider();
HtmlImportSettings importSettings = new HtmlImportSettings();
importSettings.UseHtmlHeadingStyles = true;
htmlFormatProvider.ImportSettings = importSettings;
var document = htmlFormatProvider.Import(html);
document.LayoutMode = DocumentLayoutMode.Paged;
buffer = pdfProvider.Export(document);
using (var fs = new FileStream(pdfDocPath, FileMode.Create, FileAccess.Write, FileShare.Read))
fs.Write(buffer, 0, buffer.Length);
However, I am not being able to figure out how to export multiple articles into one single PDF document. Any help would be highly appreciated.