Aspose.word - check space on page before inserting an image

Hello,

I wanted to insert an image at the current cursor’s position using DocumentBuilder.InsertImage, however if the picture is a little bit too big and inserted in the middle of the page, it gets cut.

To prevent this, i wanted to check if there will be enough space at the cursor’s position before inserting my image (if not, i will insert a page break then insert the image).

How can i do this check ?

Sincerely

@guyyyyyyyyyyy MS Word documents are flow by their nature, so there is no “page” concept. Consumer applications reflows document content into pages on the fly. So if an inline image does not fit the available space on the page it should be moved to the next page automatically.
Could you please provide sample code, template and image that will allow us to reproduce the problem. Most likely you are inserting image as floating shape. Just insert it as inline shape to resolve the problem.

1 Like

Indeed the issue was not due to the insertion but because i wrote some text before the picture, thanks for your answer.

1 Like