Inserting images into Aspose.words document

Hi ,
I am trying to insert an image into an aspose words document and am getting a blank document as a result with no image. Here is my code below , which i had taken from the aspose demo site but it’s not working for me ?

thisDocument = new Words.Document();
Words.DocumentBuilder thisDocumentBuilder = new Words.DocumentBuilder(thisDocument);
System.Drawing.Image image = System.Drawing.Image.FromFile(@"C:\\Temp\\MyTempDocFromPDFDoc_files\\img_02.gif");
thisDocumentBuilder.MoveToDocumentEnd();
thisDocumentBuilder.Font.Size = 12;
thisDocumentBuilder.InsertBreak(BreakType.SectionBreakNewPage);
thisDocumentBuilder.PageSetup.PaperSize = PaperSize.A4;
thisDocumentBuilder.PageSetup.Orientation = Orientation.Landscape;
thisDocumentBuilder.InsertImage(image);
thisDocument.Save(@"C:\\Temp\\MyDocWithImage.doc");

Any ideas would be appreciated , I have attached my image , thanks ,
Ali

Hi Ali,
Thanks for the inquiry, We have tested your code and as per our understanding you are using a large image so have to pass some parameters for image insertion setting. So we made a bit change in your code to get your desired results, We have used following InsertImage() overload method for the purpose.
thisDocumentBuilder.InsertImage(image, RelativeHorizontalPosition.Page, 30, RelativeVerticalPosition.Page,20,500,400,WrapType.None);
For complete insight please follow the following Aspose.Word documentation links. Please feel free to contact us for any further assistance. we are always glad to help you.
https://docs.aspose.com/words/net/programming-with-documents/ (Inserting a Floating (Absolutely Positioned) Image)
https://reference.aspose.com/words/net/aspose.words/documentbuilder/insertimage/
Regards,
Tilal

Hi Ali,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.3.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-6418. Your request has been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best Regards,

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

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

A post was merged into an existing topic: Insert image logo into PDF file