Hi,
Hi Thomas,
Hi Thomas,
HtmlLoadOptions options = new HtmlLoadOptions();<o:p></o:p>
options.PageInfo.Margin = new Aspose.Pdf.MarginInfo { Left = 40, Right = 40, Top = 30, Bottom = 20 };
// Instantiate Document object
Document doc = new Document("test.html", options);
MemoryStream ms = new MemoryStream();
doc.Save(ms);
doc = new Document(ms);
Aspose.Pdf.HeaderFooter header = new Aspose.Pdf.HeaderFooter();
Aspose.Pdf.HeaderFooter footer = new Aspose.Pdf.HeaderFooter();
FileStream fs = new FileStream(myDir + "logo.png", FileMode.Open, FileAccess.Read);
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
image1.FixWidth = 50;
image1.FixHeight = 50;
//Add the image into paragraphs collection of the section
header.Paragraphs.Add(image1);
//Set the ImageStream to a MemoryStream object
image1.ImageStream = fs;
//Add footer text
Aspose.Pdf.Text.TextFragment fTxt = new Aspose.Pdf.Text.TextFragment("$p / $P ");
fTxt.TextState.Font = FontRepository.FindFont("Arial");
fTxt.TextState.FontSize = 16;
fTxt.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Right;
footer.Paragraphs.Add(fTxt);
foreach (Aspose.Pdf.Page page in doc.Pages)
{
page.Header = header;
page.Footer = footer;
}
// Save PDF file
doc.Save("htmltopdf.pdf");
Yes !! Perfect !
Hi Thomas,