I have an existing word document that I’m mail merging to create a form letter. Each page must have a UNIQUE barcode inserted on the bottom of the page. I have everything working if the document is only 1 page, now I need to loop through each page and add the barcode. How would I loop through each page of an existing document? Or, how would I tell builder to move to the next page?
Current code below:
Aspose.Words.Document doc = new Aspose.Words.Document(inputWordDoc);
DocumentBuilder builder = new DocumentBuilder(doc);
#Region Start Page Loop
double bitmapWidth = ConvertUtil.InchToPoint(0.5f);
double bitmapHeight = bitmapWidth;
double top = (builder.PageSetup.PageHeight + builder.PageSetup.TopMargin + builder.PageSetup.BottomMargin) - ConvertUtil.InchToPoint(1.55f);
double left = 340f;
builder.InsertImage(GetPageBarcode(guid, pageNumber), RelativeHorizontalPosition.Page, left, RelativeVerticalPosition.Page, top, bitmapWidth, bitmapHeight, WrapType.None);
#Region End Page Loop
doc.Save(@"C:\Temp\test\Document_Lock_Confirmation_Output_WithImage.doc");
This Topic is created by imran.rafique using the Email to Topic plugin.