Hey, I have code to insert a image to the primary footer, it works for most docs, however, it failed for the attached 2 docs. It total failed for the first one, and it insert the image to some pages for the second doc, but not all the pages.
Please advise ASAP.
C# codes:
private void CreateBarcodePrimaryFooter(String barcodeText)
{
DocumentBuilder builder = new DocumentBuilder(_asposeDocument);
// Get page setup for the current section.
Aspose.Words.PageSetup pageSetup = builder.PageSetup;
// Set to 'true' if you want different headers/footers for first, even and odd pages.
pageSetup.DifferentFirstPageHeaderFooter = false;
pageSetup.OddAndEvenPagesHeaderFooter = false;
builder.MoveToHeaderFooter(Aspose.Words.HeaderFooterType.FooterPrimary);
// We use table with two cells to make one part of the text on the line (with page numbering)
// to be aligned left, and the other part of the text (with copyright) to be aligned right.
builder.StartTable();
// Calculate table width as total page width with left and right marins subtracted.
double tableWidth = pageSetup.PageWidth - pageSetup.LeftMargin - pageSetup.RightMargin;
builder.InsertCell();
// Set first cell to the page width.
builder.CellFormat.Width = tableWidth ;
builder.InsertImage(CreateBarCodeImage(barcodeText));
// Align this text to the left.
builder.CurrentParagraph.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.EndRow();
builder.EndTable();
}
private Image CreateBarCodeImage(String barcodetext)
{
BarCodeBuilder builder = new BarCodeBuilder();
builder.SymbologyType = Aspose.BarCode.Symbology.DataMatrix;
builder.CodeLocation = CodeLocation.None;
builder.CodeText = barcodetext;
return builder.GenerateBarCodeImage();
}