EnhMetaFileBits

R

Rama

Hi,
I'm copying an image using the following code(EnhMetaFileBits concept).
My problem here is I cant get the original size of the image whne I copy the
picture. is there anyway to get the original size of the picture?


Public Sub SaveImage()
Dim ImageStream As Object
Set ImageStream = CreateObject("ADODB.Stream")
With ImageStream
.Type = 1 ' adTypeBinary
.Open
.Write (Selection.EnhMetaFileBits)
.SaveToFile ("C:\Imagejan077.bmp")
.Close
End With
Set ImageStream = Nothing
End Sub
I've searched the web and found that if i convert the bytes to metafile
format I can use drawing concepts of the metafile to get the size but I'm not
expert on drawing(namespace) and its usage.

// Create a meta file using the byte array returned from EnhMetaFileBits
byte[] emfData = (byte[])wdApp.Selection.EnhMetaFileBits;
System.IO.MemoryStream ms = new System.IO.MemoryStream(emfData);
Metafile mf = new Metafile(ms);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top