How is this EMF image A4 sized?
-
13-07-2021 - |
質問
An EMF file made by Adobe Illustrator (I do not know which version, but it has one of the early style EMR headers) is supposed to be A4 sized and I don't understand how it could be. The file has these EMR records:
U_EMRHEADER record: 0 type: 1 offset: 0 size: 116
rclBounds: {255,-925,1377,-132}
rclFrame: {7969,-28906,43031,-4125} **350.63 x 247.82 mm**
dSignature: 0x464D4520
nVersion: 0x00010000
nBytes: 1924
nRecords: 54
nHandles: 4
sReserved: 0
nDescription: 13
offDescription: 88
Desc. A: Adobe Systems
Desc. B:
nPalEntries: 0
szlDevice: {1024,768}
szlMillimeters: {320,240}
U_EMRSETMAPMODE record: 1 type: 17 offset: 116 size: 12
iMode: 0x00000008 **MM_ANISOTROPIC**
U_EMRSETWINDOWORGEX record: 3 type: 10 offset: 140 size: 16
ptlOrigin: {0,0}
U_EMRSETVIEWPORTORGEX record: 4 type: 12 offset: 156 size: 16
ptlOrigin: {0,0}
U_EMRSETWINDOWEXTEX record: 5 type: 9 offset: 172 size: 16
szlExtent: {10104,7143}
U_EMRSETVIEWPORTEXTEX record: 6 type: 11 offset: 188 size: 16
szlExtent: {3368,2381}
The rclFrame fields normally set the page size but A4 is 297 x 210 mm, not 350.63 x 247.82 mm. However 350.63 x 247.82 is the correct ratio for A4. The only way I could finagle an A4 size out of these numbers was by treating the rclFrame values as MM_HIENGLISH and then using the 1/3 scale factor from EMRSETWINDOWEXTEX/EMRSETVIEWPORTEXTEX this way:
35.063" * 1/3 = 11.69"
24.782" * 1/3 = 8.26"
But that would mean that the program could not determine the size of the page until it had seen those latter two records. Also nowhere could I find any documentation that said this sort of thing goes on.
Can anybody shed some light on this?
正しい解決策はありません
他のヒント
I think your EMF may contain more information than is indicated by the diagnostic dump. The supplied EMR_HEADER record has nVersion set to 0x00010000 so the record aditionally contains these fields starting after szlMillimeters:
public uint cbPixelFormat;
public uint offPixelFormat;
public uint bOpenGL;
public SIZE szlMicrometers;
The values of these fields are missing from the supplied diagnostic dump. Here's a hex dump from the head of an XP emf file I had on my machine:
0: 01 00 00 00 6c 00 00 00 58 07 00 00 03 02 00 00 | ....l...X....... |
10: aa 0b 00 00 1f 04 00 00 95 1f 00 00 07 09 00 00 | ................ |
20: 07 31 00 00 15 11 00 00 20 45 4d 46 00 00 01 00 | .1...... EMF.... |
30: 44 07 00 00 2e 00 00 00 03 00 00 00 00 00 00 00 | D............... |
40: 00 00 00 00 00 00 00 00 61 13 00 00 68 1b 00 00 | ........a...h... |
50: d2 00 00 00 29 01 00 00 00 00 00 00 00 00 00 00 | ....)........... |
60: 00 00 00 00 50 34 03 00 28 88 04 00 | ....P4..(... |
In this snippet, the szlMicrometers field is the last pair of DWORDs. Their values are 0x00033450, 0x00048828, and expressed in decimal in thousandths of a mm these values are 210000, 297000