When I use page break, the shape disappears on a specific page

I would like to have 4 shapes printed on each page.

If I run the generateWord() function, the shape is not printed only on the second page.

Why isn’t the shape printed on the second page?

I am attaching the word file in question.

generateWord()

private fun generateWord(path: String) {
        val document = Document()
        val builder = DocumentBuilder(document)

        DocumentUtils.generateLine(builder)
        builder.insertBreak(BreakType.PAGE_BREAK)

        DocumentUtils.generateLine(builder)
        builder.insertBreak(BreakType.PAGE_BREAK)

        DocumentUtils.generateLine(builder)
        builder.insertBreak(BreakType.PAGE_BREAK)

        DocumentUtils.generateLine(builder)
        
        document.save(path)
}

generateLine()

fun generateLine(builder: DocumentBuilder) {
            builder.also {
                it.insertParagraph()
                val shape = Shape(builder.document, ShapeType.LINE).apply {
                    width = 452.0
                    top = 10.0
                }
                it.insertNode(shape)
            }
}

kr20160003066u.docx (5.7 KB)

@URLENCE Could you please elaborate your question in more details. As I can see the shape (line) is present on each page in your document:

I checked both your document and document generated by your code on my side using the latest 22.5 version of Aspose.Words for Java. Here is the document generated on my side: out.docx (7.3 KB)

@alexey.noskov I’m using version 18.1. Is it a bug that occurs in this version?

@URLENCE The attached screenshot was made from your document. As I mentioned both documents your and generated on my side look the same and I can see the shape on each page. I checked the document in MS Word.
Maybe the problem is in the consumer application. What application do you use to view the document.

@alexey.noskov oh…
I am currently using the Mac version office.

@alexey.noskov
If there is no problem with the code, I will look into this problem. Thank you for your answer.
Finally, my code is fine, right?

@URLENCE Yes, your code is correct and generates correct document with shape on each page. If you need a shape on each page, maybe you can simply insert it into the primary header of the document.
https://docs.aspose.com/words/java/working-with-headers-and-footers/
In this case shape will be inserted only once but will be displayed on each page.