We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

insertImage - broken in recent release - does not size properly


I have found another feature that used to work but has been broken in a recent release of Aspose.Words.

We have a document as attached, as well as an image, also attached.

We have been using docBuilder.insertImage() to insert the image. We want the image to float on the page and to stretch 100% of the page width and 100% of the page height.

We are reading the image binary.

<cfif docBuilder.moveToBookmark(replaceItem)>
<cfset bookmark.remove()>
<cfset docBuilder.insertImage(imageBinary,rhp,0,rvp,0,612,792,wt)>
<cfset docBuilder.insertParagraph()>

No matter what height and width we set, it only appears to cover about 75% of the width and height of the page. It should fill the entire page with a WxH of 612x792 .

See the attached output document.

For reference, the images we use in production are the correct aspect ratio to fill the page without stretching. I realize the sample image is not; however, it still will not stretch to fill either dimension.

Note that using a negative value for height/width - as specified in the documentation, does not work either.
width - The width of the image in points. Can be a negative value to request 100% scale.
height - The height if the image in points. Can be a negative value to request 100% scale.

Please advise. Thank you.

Hi Chris,

Thanks for your inquiry. We are working over your query and will update you asap.

Hi Chris,

Thanks for your patience. I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-12525. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Please use following code example as a workaround of this issue. Hope this helps you.

Document doc = new Document(MyDir + "testImage.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertImage(MyDir + "skeletor.jpg");
doc.save(MyDir + "Out.docx");

The issues you have found earlier (filed as WORDSNET-12525) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.