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

Free Support Forum - aspose.com

Image included with mergefield but displayed with differents sizes

Hi,

In my application, I load 5 images with the same sizes (133x100 pixels) in a Word template document.
I use 5 merges fields.

[Template]
{ MERGEFIELD Image:image1 }
{ MERGEFIELD Image:image2 }
{ MERGEFIELD Image:image3 }
{ MERGEFIELD Image:image4 }
{ MERGEFIELD Image:image5 }
[/Template]

<br>Document myDoc = new Document("[...]\template.doc");<br>Dictionary<String, String> myImages = new Dictionary<string, string>();<br><br>myImages.Add("image1", "[...]\image1.jpg");<br>myImages.Add("image2", "[...]\image2.jpg");<br>myImages.Add("image3", "[...]\image3.jpg");<br>myImages.Add("image4", "[...]\image4.jpg");<br>myImages.Add("image5", "[...]\image5.jpg");<br><br>myDoc.MailMerge.Execute(</font></font><font face="Courier New" size="2">myImages.Keys.ToArray()</font><font face="Courier New" size="2">,<br></font><font face="Courier New" size="2"> myImages.Values.ToArray()</font><font face="Times New Roman"><font face="Courier New" size="2">);<br>

Do you know why in the document, the 5 images don’t be displayed with the same sizes ?
I read this post <here> to force the image sizes but I think there is a solution more simple to display an image without any change. Do you already have this problem ?

Thanks,

Vic


Hi
Victor,


Thanks for your inquiry. This is not a bug. Aspose.Words does nothing with the size of image during mail merge. The original size of your image is 133x100 pixels; however when viewed with MS WORD these images are displayed on a scale of inches i.e. 0.33x0.44 inches.

Please let us know if you need more information, we are always glad to help you.

Best Regards,

It's weird. I throught the same sizes in pixels give the same sizes in inches. For examples :
image1.jpg : 133x100 pixels > 0,33x0,44 inches
image2.jpg : 133x100 pixels > 0,33x0,44 inches
image3.jpg : 133x100 pixels > 0,33x0,44 inches
image4.jpg : 133x100 pixels > 0,33x0,44 inches
image5.jpg : 133x100 pixels > 0,33x0,44 inches

But in my test, there are differents sizes :
image1.jpg : 133x100 pixels > 0,33x0,44 inches
image2.jpg : 133x100 pixels > 0,33
x0,44 inches
image3.jpg : 133x100 pixels > 0,33x0,44 inches
image4.jpg : 133x100 pixels > 0,33x0,44 inches
image5.jpg : 133x100 pixels > 0,18x0,24 inches

My colleague solved my problem with Paint.NET. He just take the file (image5.jpg) and use Paint.NET to save as another file (image5b.jpg). Then, after building :
image5b.jpg : 133x100 pixels > 0,33x0,44 inches (Paint.NET)
image5.jpg : 133x100 pixels > 0,18x0,24 inches (Photoshop CS5)
I don't understand this behavior...

By the way, thank you for your answer.

Vic

Hi
Victor,


Thanks for your feedback. It is perfect that you managed to resolve the problem; however, could you please attach image5.jpg Photoshop CS5 file here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

In my first post, the original_image.jpg is the good one (CS5, view in exif data).

Hi Victor,


Thanks for your inquiry. While using latest version of Aspose.Words 11.0.0, i am unable to reproduce this issue. I have attached Template along with output Word document.

In case of any ambiguity, please let me know.

Hi !

Sorry I forgot to specify my version of Aspose.Words. I use an old version 10.5.0.0.
I didn't ask to my company to buy the lastest version yet.

Vic

Hi Victor,

Thank you for further details, We recommend you to only use latest version as the new version has lots of enhancements and provides feature rich APIs set. We have reshaped APIs set and included new useful features too. The performance is also increased to great deal.