Hi,
I m converting Html to PDF using Aspose PDF .Net. In this process, I want to add HTML to header & Footer. For this, I m looping through all the pages and by using HTML Fragment assigning the HTML content to the “page.Header”. It is working as expected but taking too much time to save the document to memory stream. Below is the pseudo code for the same.
Pseudo code:
var ms = new MemoryStream();
Document doc = new Document(ms, new HtmlLoadOptions());//This also takes around 1 min
foreach (Page page in doc.Pages)//We have around 60 pages
{
Aspose.Pdf.HeaderFooter header = new Aspose.Pdf.HeaderFooter();
HtmlFragment htmlFrag = new HtmlFragment(“
//Some code to set appropriate position for header /footer
header.Paragraphs.Add(htmlFrag);
page.Header = header;
}
doc.Save(ms, Aspose.Pdf.SaveFormat.Pdf);//Taking too much time for saving (around 2 mins)
Thanks,
Ajay Kumar