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

Free Support Forum - aspose.com

Issues with image size in generated document

I’m having some issues while generating PDF , i have images in a database that i retrieve as a byte[] , when i save those to a file they have the expected size when opened in any image editing program (without any configuration) when i add them to my data source they appear to be shrunk.
Any pointers as to what may happen? Any requirements on the image for it to appear correctly sized?
One thing we noted is that if we generate for word instead of pdf we get the same issue, however when we extract the image from the word file it’s back to it’s normal size so my guess is some kind of auto scaling is applied in both cases but i would like to avoid this.
I don’t do anything specific with the image beforehand and simply assign the array to my data source, on the template side i don’t see anything suspicious either, it is included as such :
Any help on the subject is most welcome as this is an issue for putting our pdf generation system in production.
Best regards.

Thanks for your inquiry. Could you please attach sample images, template and code, that will allow me to reproduce the problem on my side? I will check the issue and provide you more information.
Best regards,

We simple add the image data to a data source as such:

var v = SomeImageList
.Select(Img => new
Title = Img.title,
Image = Img.ImgByteArray // retrieved directly from a blob in sql server

this.DataSourceRoot.AddDataSource(new DocumentDataSource(v, "Image"));


Thank you for additional information. As I can see, Aspose.Words inserts the image with correct size. I see the same size of the image if I insert it into the document using MS Word.
Best regards,


can you send the test you used to see the correct size of the image please.
In both cases, Aspose.Words and MS Word, I have the same size of the image but it’s smaller in the document than the original size.

Hi Gurvan,
Thanks for your request. In my test document image is also smaller than it is when open it in image viewer. This seems to occur because image has 300dpi resolution, and MS Word interpret the image size differently than image viewers.
Best regards,