shapoval wrote:... When adding metafiles, I scale them to the size of the page by adjusting TMetafile.MMHeight and MMWidth. I use TRichView.DocParameters.PageWidth and PageHeight to get the available width and height of the document.
...
However, when I export it to RTF, the picture doesn't have the desired size. On my PC it looks much smaller than the page width. After some experiments I've found that it looks as I want when I set MMWidth to the value of about 35000, while the page width is 297 mm (A4 landscape). The biggest problem, however, is the fact that on the customer's PC the resulting picture is bigger than the page (not smaller as in my case), so I can't simply use that empirical value. It makes me think that there is some additional scaling somewhere. Do you, may be, know what's going on?
Before I started using TRichView, I had to do the opposite of what you are trying to do -- manually extract the WMF data out of RTF files. The WMF data includes the image width and height, but not in "pixel" values. There are two sets of RTF values:
\picw, \pich
\picwgoal, \pichgoal
The 1st params are values measured in 100th of a milimeter. The 2nd params are values measured in twips. To calculate the pixels for the first, I use "picw * DPI / 2540". The pixels for the second are "picwgoal * DPI / 1440".
The static values 2540 and 1440 are useful as empirical values. The DPI however can be different on each user's computer, which is likely why you are seeing the image smaller on your computer and larger on a customer's computer. The DPI is typically 96, 120 or 150, depending on whether the user has elected to use 'Large Fonts' in Windows. You can access the user's DPI setting using "Screen.PixelsPerInch" in Delphi.
While this isn't the exact formula you need to use, hopefully it will point you in the right direction and you will be able to use something like "width / DPI * 2540" or "width / DPI * 1440"...