Hi everyone,
I need to format a document that has a header generated by Aspose.Pdf but the body is generated by Aspose.Words and the footer generated by Aspose.Pdf. The reason for this is that we are getting a HTML in MS Outlook format which can not be parsed by Aspose.Pdf, but if we generate the header using Aspose.Words, it messes up the heading. Here is the code we are using for the pdf header, so any ideas on how to do this?
Thanks,
PDF generation code:
Pdf pdf = new Pdf();
pdf.IsTruetypeFontMapCached = false;
pdf.PageSetup.PageHeight = PageSize.A2Height;
pdf.PageSetup.PageWidth = PageSize.A2Width;
Aspose.Pdf.Generator.Section secHeader = pdf.Sections.Add();
Aspose.Pdf.Generator.HeaderFooter header = new Aspose.Pdf.Generator.HeaderFooter(secHeader);
secHeader.OddHeader = header;
Table tableLogo = new Table();
tableLogo.PositioningType = PositioningType.ColumnRelative;
header.Paragraphs.Add(tableLogo);
tableLogo.DefaultCellBorder = new BorderInfo((int) BorderSide.None, 0.1 F);
tableLogo.ColumnWidths = "500 500";
Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();
img.ImageInfo.File = @"F:\logo999_110.bmp";
img.ImageInfo.ImageFileType = ImageFileType.Bmp;
img.ImageInfo.FixWidth = 1000;
Row row1 = tableLogo.Rows.Add();
Cell cellImage = row1.Cells.Add();
cellImage.Paragraphs.Add(img);
tableLogo.Rows[0].Cells[0].ColumnsSpan = 2;
Row row2 = tableLogo.Rows.Add();
row2.BackgroundColor = new Aspose.Pdf.Generator.Color("#0000A0");
row2.DefaultCellTextInfo.Color = new Aspose.Pdf.Generator.Color("#FFFFFF");
row2.DefaultCellTextInfo.FontName = "Verdana";
row2.DefaultCellTextInfo.FontSize = 12;
Cell cellTitle = row2.Cells.Add("Title");
cellTitle.Alignment = AlignmentType.Left;
Cell cellDate = row2.Cells.Add("20 November 2011");
cellDate.Alignment = AlignmentType.Right;
Row row3 = tableLogo.Rows.Add();
row3.DefaultCellTextInfo.FontSize = 12;
row3.DefaultCellTextInfo.FontName = "Arial";
Cell cellName = row3.Cells.Add("FirstName LastName");
cellName.Alignment = AlignmentType.Left;
Cell cellEmail = row3.Cells.Add("FirstName.LastName@companyname.com");
cellEmail.DefaultCellTextInfo.Color = new Aspose.Pdf.Generator.Color("#00FFFF");
cellEmail.Alignment = AlignmentType.Right;
pdf.Save("C:\\temp\\test.pdf");