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

Free Support Forum - aspose.com

Issues with image size in generated document

Hello,
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 :
{ MERGEFIELD Image:ImageSample * MERGEFORMAT}
Any help on the subject is most welcome as this is an issue for putting our pdf generation system in production.
Best regards.

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0pt 5.4pt 0pt 5.4pt; mso-para-margin:0pt; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:SimSun; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi

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”));


{ MERGEFIELD Image:Image * MERGEFORMAT }

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0pt 5.4pt 0pt 5.4pt; mso-para-margin:0pt; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:SimSun; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Hi

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,

Hi,

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.

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0pt 5.4pt 0pt 5.4pt; mso-para-margin:0pt; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:SimSun; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:Arial; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

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,