Hi
I am trying to convert html to pdf using aspose word. Everything is going fine only footer is not coming in proper place. Footer I am creating using DocumentBuilder. There is lot of space after footer. Please find attached pdf in zipped file.
Below is the code, I am using to generate the pdf file.
Aspose.Words.License wlicense = new Aspose.Words.License();
wlicense.SetLicense(@"C:\GauravSaxena\Aspose\Aspose.Total.lic");
//// Load HTML file
// For older version"Aspose_Table_Report.html";//
string htmlFileName = "Map_Html_For_AsposeWords_Table_Format.html";
string pdfFilePath = @"C:\TEMP\PDF";
string pdffileName = "AsposeWords_" + DateTime.Now.Ticks + "_Report.pdf";
Aspose.Words.LoadOptions lOptions = new Aspose.Words.LoadOptions();
lOptions.LoadFormat = Aspose.Words.LoadFormat.Html;
Aspose.Words.Document doc = new Aspose.Words.Document(System.IO.Path.Combine(pdfFilePath, System.IO.Path.Combine(pdfFilePath, htmlFileName)));
DocumentBuilder builder = new DocumentBuilder(doc);
Section currentSection = builder.CurrentSection;
PageSetup pageSetup = currentSection.PageSetup;
pageSetup.LeftMargin = 1d;
pageSetup.RightMargin = 1d;
pageSetup.BottomMargin = 0d;
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary); // for instance first page header
builder.PageSetup.LeftMargin = 10d;
Aspose.Words.Tables.Table table = builder.StartTable();
// Clear table borders
builder.CellFormat.ClearFormatting();
builder.InsertCell();
// Set first cell to 1/3 of the page width.
builder.CellFormat.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPercent(100 / 3);
// Insert page numbering text here.
// It uses PAGE and NUMPAGES fields to auto calculate current page number and total number of pages.
builder.Write("tseting@testing.com | Page ");
builder.InsertField("PAGE", "");
builder.Write(" of ");
builder.InsertField("NUMPAGES", "");
// Align this text to the left.
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Left;
builder.InsertCell();
// Set the second cell to 2/3 of the page width.
builder.CellFormat.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPercent(100 * 2 / 3);
String imageFileName = Path.Combine(pdfFilePath, "logo-test.png");
builder.InsertImage(imageFileName, Aspose.Words.Drawing.RelativeHorizontalPosition.Page, 200, Aspose.Words.Drawing.RelativeVerticalPosition.Page, 10, 25, 25, Aspose.Words.Drawing.WrapType.Tight);
// Align this text to the right.
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.EndRow();
builder.EndTable();
builder.MoveToDocumentEnd();
doc.Save(Path.Combine(pdfFilePath, pdffileName), Aspose.Words.SaveFormat.Pdf);
Thanks
Gaurav