Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecifying DPI of a GDI Device Context
    primarykey
    data
    text
    <p>I have an application that generates metafiles (EMFs). It uses the reference device (aka the screen) to render these metafiles, so the DPI of the metafile changes depending on what machine the code is running on.</p> <p>Let's say my code is intending to create a metafile that is 8.5 in x 11 in. Using my development workstation as a reference, I end up with an EMF that has</p> <ul> <li>an rclFrame of { 0, 0, 21590, 27940 } (dimensions of the metafile, in thousandths of a mm)</li> <li>a szlDevice of { 1440, 900 } (dimensions of the reference device, in pixels)</li> <li>a szlMillimeters of { 416, 260 } (dimensions of the reference device, in mm)</li> </ul> <p>Okay, so the rclFrame tells me that the size of the EMF should be</p> <ul> <li>21590 / 2540 = 8.5 in wide</li> <li>27940 / 2540 = 11 in tall</li> </ul> <p>Right on. Using this information, we can determine the physical DPI of my monitor, too, if my math is right:</p> <ul> <li>(1440 * 25.4) / 416 = 87.9231 horizontal dpi</li> <li>(900 * 25.4) / 260 = 87.9231 vertical dpi</li> </ul> <h3>The problem</h3> <p>Anything that plays back this metafile--an EMF-to-PDF conversion, the "Summary" page when right-click on the EMF in Windows Explorer, etc--seems to truncate the calculated DPI value, displaying 87 instead of 87.9231 (even 88 would be fine).</p> <p>This results in a page that is physically sized as 8.48 in x 10.98 in (using 87 dpi) instead of 8.5 in x 11 in (using 88 dpi) when the metafile is played back.</p> <ul> <li>Is it possible to change the DPI of the reference device so that the information stored in the metafile used to calculate the DPI comes out to a nice integer?</li> <li>Can I create my own device context and specify its DPI? Or do I really have to use a printer to do that?</li> </ul> <p>Thanks for any insight.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload