Thank your for your quick reply.
However, we are not inserting images into the document using the IMAGE we are inserting HTML that contain img tags that reference local files.
I ran a test merging HTML using LINQ Reporting Engine that references 4 files. These were all of the same image only:
-
The first image is 600 x 400 pixels / 8.333 x 5.556 inches at 72 dpi.
-
The second image is 600 x 400 pixels / 6.250 x 4.167 inches at 96 dpi.
-
The third image is 1200 x 800 pixels / 12.500 x 8.333 inches at 96 dpi.
-
The fourth image is 1875 x 1250 pixels / 6.250 x 4.167 inches at 300 dpi.
<p>72 DPI</p>
<p><img src=“c:\TestImg_72dpi.jpg” /></p>
<p> </p>
<p>96DPI</p>
<p><img src=“c:\TestImg_96dpi.jpg” /></p>
<p> </p>
<p>96DPI 200% size</p>
<p><img src=“c:\TestImg_96dpi_200%.jpg” /></p>
<p> </p>
<p>300DPI</p>
<p><img src=“c:\TestImg_300dpi.jpg” /></p>
<p> </p>
The space on the page where the images are being inserted is 5.28" wide.
- The 1st image did not fit properly on the page.
- However the 2nd and 3rd did.
- And the 4th at 300 dpi scaled up by 313%
If you look at the document generated in MS Word:
Image 1:
- Original Width: 8.33", Original Height: 5.56"
- Scaled Width: 6.25", Scaled Height: 4.17" (specified in docx file as EMUs)
- scaled 75% (should have scaled down about 63% to fit 5.28")
Image 2:
- Original Width: 6.25", Original Height: 4.17"
- Scaled Width: 5.28". Scaled Height: 3.52" (specified in docx file as EMUs)
- scaled 84%
Image 3:
- Original Width: 12.5", Original Height: 8.33"
- Scaled Width: 5.28". Scaled Height: 3.52" (specified in docx file as EMUs)
- scaled 42%
Image 4:
- Original Width: 6.25", Original Height: 4.17"
- Scaled Width: 13.02". Scaled Height: 19.53" (specified in docx file as EMUs)
- scaled 313%
Looking at the document.xml in the generated .docx file:
EMU = pixels * 914400 / Resolution
pixels = EMU * Resolution / 914400
The first picture (72 dpi) has the following in document.xml:
<a:xfrm><a:off x=“0” y=“0” /><a:ext cx=“5715000” cy=“3810000” /></a:xfrm>
width: 5715000 EMUs = 6.25 inches
height: 3810000 EMUs = 4.17 inches
The second picture has:
<a:xfrm><a:off x=“0” y=“0” /><a:ext cx=“4826000” cy=“3217333” /></a:xfrm>
width: 4826000 EMUs = 5.28 inches
height: 3217333 EMUs = 3.52 inches
The third picture has scaled correctly:
<a:xfrm><a:off x=“0” y=“0” /><a:ext cx=“4826000” cy=“3217333” /></a:xfrm>
width: 4826000 EMUs =
height: 3217333 EMUs = pixels * 914400 / Resolution
The fourth picture at 300 dpi LINQ did not attempt to resize and calculated the width and height using 96 dpi instead of the original 300 dpi:
<a:xfrm><a:off x=“0” y=“0” /><a:ext cx=“17859375” cy=“11906250” /></a:xfrm>
width: 17859375 EMUs = 1875 pixels * 914400 / 96 (NOT the 300 dpi of the image)
height: 11906250 EMUs = 1250 pixels * 914400 / 96 (NOT the 300 dpi of the image)
So there seems to be a calculation error when sizing an image to fit the MS Word page when the image isn’t at 96dpi. If I insert the same images into the word document using insert image they insert and scale properly.