Hi,
I am trying to implement a fix for the little white buffer that appears when Visio shape is exported as metafile (EMF).
When you do PasteSpecial -> Export as EMF and then resize the image back to the original size there is a small white buffer that is visible when you place many copies of the same image next to each other.
For example, my image has a rectange 30x290, but when exported as EMF it gets a size of 29.xx x 289.xx although the image size is 30x290 (units does not matter).
I was previously using these EMFs in PDF (i.e. export the EMF as PDF) and fixing this problem on the PDF side - get the PDF, get bounding box and transformation matrix, iterate over all drawing elements, get their coordinates and then some math...
Now, I need to do this in C# automation and I am having a problem to get the shape as a metafile. If I get it as metafile, then I will probably be able to examine the EMF stream and figure out what I need. My Problem:
I have a shape which has Shape.ForeignType = 16 (visTypeMetafile)
How would I cast/convert this shape to Imaging.Metafile
Thanks,
Svet
I guess, I had to do a bit more on my own before posting ...
Array ar = shape.ForeignData;
byte[] bytes = new Byte[ar.Length];
for (int i = 0; i < ar.Length; i++)
bytes = (byte)ar.GetValue(i);
MemoryStream strm = new MemoryStream(bytes);
Metafile mf = new Metafile(strm);
Back to the fight with EMF.