How to align images and text labels on a single page in Google Docs using Apps Script

I’m utilizing Google Apps Script to transfer data from Google Forms into a Google Document. Among the form submissions, there are several images, and while I can successfully insert them into the document, I also want to append a descriptive text label. Currently, I’m using the following code snippet within a loop:

content.insertParagraph(positionIndex++, entry[0] + ': ');
content.insertImage(positionIndex++, fetchImage(resource[entry[0]][0]));

However, there are instances where the image and its corresponding label are displayed on different pages, as illustrated in the screenshot below:

What approach should I take to ensure they remain together on the same page?

You might wanna try puttin’ the label and image in a table or a single paragraph. That way, they should stay together without jumpin’ to diff pages. Also, reducing image size might help in fitting everything neatly on the same page. Hope it helps!