Thanks, figured it out using a windows clipboard api. Thought I'd post for others:
Public Class ClipboardAPI
<DllImport("user32.dll", EntryPoint:="OpenClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function OpenClipboard(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="EmptyClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function EmptyClipboard() As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="SetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function SetClipboardData(ByVal uFormat As Integer, ByVal hWnd As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="CloseClipboard", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function CloseClipboard() As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="GetClipboardData", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function GetClipboardData(ByVal uFormat As Integer) As IntPtr
End Function
<DllImport("user32.dll", EntryPoint:="IsClipboardFormatAvailable", _
SetLastError:=True, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function IsClipboardFormatAvailable(ByVal uFormat As Integer) As Short
End Function
End Class
dim xBuilder As DocumentBuilder
Const CF_ENHMETAFILE As Integer = 14
Dim henmetafile As IntPtr
Dim metaFile As System.Drawing.Imaging.Metafile
If ClipboardAPI.OpenClipboard(Me.Handle) Then
If ClipboardAPI.IsClipboardFormatAvailable(CF_ENHMETAFILE) <> 0 Then
henmetafile = ClipboardAPI.GetClipboardData(CF_ENHMETAFILE)
metaFile = New System.Drawing.Imaging.Metafile(henmetafile, True)
ClipboardAPI.CloseClipboard()
End If
End If
Try
xBuilder.InsertImage(metaFile, 574.55, 487.45)
Catch ex As Exception
End Try