a) Trying to insert images manually into a document using the following code
Dim doc As New Aspose.Word.Document(Me.txtTemplate.Text)
Dim builder As Aspose.Word.DocumentBuilder = New DocumentBuilder(doc)
builder.InsertImage("testimage.jpg", RelativeHorizontalPosition.Margin, 114, RelativeVerticalPosition.Margin, 283, 200, 200, WrapType.None, WrapSide.Left, True, Nothing)
However, this image is to be used like a watermark, and as such should appear BEHIND the text. I read the doco and assumed that the “IsBelowText” parameter (2nd last) would render the image behind the text. However, the value of IsBelowText (T/F) doesn’t seem to do anything.
In the output document - a right click on the image and select ORDER -> Send Behind Text gives the desired result.
b) Could you please provide a code sample for repeating the image insertion on EVERY page? Looping by sections doesn’t work as there can be multiple sections on a single page.
And a related question to b) - is there any mechanism for moving the doc builder between ‘pages’ in a doc ( rather than sections). How, for example, is it possible to insert an image on pages 2 and 6?..
Insert below text has just been fixed in ASpose.Word 3.0.2. You can download and try.
Moving to a particular page is not possible because Aspose.Word does not know where each page starts and ends. This has to be calculated using a page layout engine that is not yet available.
As you have already found out HeaderFirst means header of the first page. It is worth nothing that to actually make the header/footer of the first page visible one also needs to set Section.PageSetup.DifferentFirstPageHeaderFooter. Basically it means it is perfectly valid for an MS Word document to have first page headers/footers defined but don’t show them. Similarly for different odd/even pages headers and footers.