I want to Convert HTML Page to PDF In the HTML Page I am getting like html.docx (12.8 KB)
For convert HTML to PDF I written code like
var pathToCreatehtml = Server.MapPath("~/PDFViewer/web/" + attachechedFileName);
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense("Aspose.Words.lic");
Aspose.Words.LoadOptions ldOptions = new Aspose.Words.LoadOptions();
ldOptions.Encoding = System.Text.Encoding.UTF8;
ldOptions.LoadFormat = Aspose.Words.LoadFormat.Doc;
Aspose.Words.Document doc = new Aspose.Words.Document(pathToCreatehtml, ldOptions);
// Render first page of Word document to an image stream
//Aspose.Words.Saving.ImageSaveOptions options = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg);
//options.PageIndex = 0;
//options.PageCount = 1;
//MemoryStream imgStream = new MemoryStream();
//doc.Save(imgStream, options);
foreach (Section section in doc.Sections)
{
section.PageSetup.PaperSize = Aspose.Words.PaperSize.A4;
}
doc.UpdatePageLayout();
doc.ExpandTableStylesToDirectFormatting();
doc.Save(pathToCreate, Aspose.Words.SaveFormat.Pdf);
When I using this code I am getting output in HTML
But By using aspose I am getting output like
The footer is supposed to display below, but in the PDF, the footer is appearing at the top of the body within the table.